still confused about call by reference

Hoenir mrmocool at gmx.de
Sun Oct 28 20:32:44 PDT 2007


I'm still a bit confused about call by reference. When do I have to 
explicitly use the & operator and when to use in, out and inout?
I want to convert my C++ vector struct to D:

struct vec3
{
	vec3 operator+(const vec3& v) const
	{return vec3(x+v.x, y+v.y, z+v.z);}
	vec3 operator-(const vec3& v) const
	{return vec3(x-v.x, y-v.y, z-v.z);}

I'm also wondering about how to handle the constness.
Thanks in advance for any help :)


More information about the Digitalmars-d-learn mailing list