|
板凳
楼主 |
发表于 2016-4-21 08:55:46
|
只看该作者
但是后面很奇怪啊,这是IVF14.0的手册,不能有nopass属性,我就理解成必须有pass属性
一个操作符必须有pass属性我是着实没明白意图。最后只能这样
type::vector
real::x
real::y
real::z
contains
! type bounded procedures
generic::assignment(=)=>array_to_vector,vector_to_array
generic::operator(+)=>vector_add
generic::operator(-)=>vector_subtract
generic::operator(*)=>vector_times_real,real_times_vector,vector_times_int,int_times_vector,cross_product
generic::operator(/)=>vector_div_real,vector_div_int
generic::operator(.dot.)=>dot_product_
procedure,pass(vec_result)::array_to_vector
procedure,pass(vec_1)::vector_to_array
procedure,pass(vec_1)::vector_add
procedure,pass(vec_1)::vector_subtract
procedure,pass(vec_1)::vector_times_real
procedure,pass(vec_2)::real_times_vector
procedure,pass(vec_1)::vector_times_int
procedure,pass(vec_2)::int_times_vector
procedure,pass(vec_1)::cross_product
procedure,pass(vec_1)::vector_div_real
procedure,pass(vec_1)::vector_div_int
procedure,pass(vec_1)::dot_product_
end type
因为本类型可以在第一个形参也可以是第二个上面,这样可以过编译,但是用起来还不如interface operator了;
|
|