www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Alternative solutions to returning ref types.

Christopher Wright Wrote:
 Have you tried it with any UDTs that don't overload all those operators? 
 The unary operators will die; the binary ones are hidden behind 
 templates so they're okay unless someone uses them.
 You'll need guards like:
 T opNeg()
 	static if (is (typeof(-(*data))))
 		return -(*data);
 		assert (false, "type " ~ T.stringof ~ " does not support this operator."

Right. Tried it before I added the unary operators, forgot to test those. Thanks. -- Simen
Mar 17 2008