still confused about call by reference

Hoenir mrmocool at gmx.de
Tue Oct 30 04:58:07 PDT 2007


Derek Parnell schrieb:
>     void opCall(T,U,V)(const T a, const U b, const V c)
>     {
>         x = cast(VT)a;
>         y = cast(VT)b;
>         z = cast(VT)c;
>     }
Thanks for your code. But is there a way to use code like the following:

vec3 opSub(vec3 v) {return vec3(x-v.x, y-v.y, z-v.z);}

It doesn't work with
	vec3 opCall(U,V,W)(U a, V b, W c)
	{
		x = cast(T)a;
		y = cast(T)b;
		z = cast(T)c;
		return *this;
	}
Tells me "type vec3!(real) is not an expression". (typedef double real)
btw is it possible to return pointers?


More information about the Digitalmars-d-learn mailing list