DIP 36: Rvalue References

Minas Mina minas_mina1990 at hotmail.co.uk
Wed Apr 17 13:18:54 PDT 2013


On Wednesday, 17 April 2013 at 19:29:51 UTC, Namespace wrote:
>> Finally, I'm tired of copy-pasting the same code just to 
>> change to "ref". :)
>
> What do you mean?

This:

/// dot product of two Vector3 vectors
auto dot(T) (Vector3!T u, Vector3!T v) @safe pure nothrow
{
	return u.x * v.x + u.y * v.y + u.z * v.z;
}

/// dot product of two Vector3 vectors
auto dot(T) (ref Vector3!T u, ref Vector3!T v) @safe pure nothrow
{
	return u.x * v.x + u.y * v.y + u.z * v.z;
}


More information about the Digitalmars-d mailing list