Problem with Variant

develop32 develop32 at gmail.com
Fri Jun 28 16:27:06 PDT 2013


void main()
{
	struct Vector
	{
		float length();
	}

	import std.variant;
	Variant v = Vector();
}

Currently this does not work, as it seems Variant thinks length() 
is a property restricted to arrays.

"cannot implicitly convert expression ((*zis).length()) of type 
float to int	C:\D\dmd2\src\phobos\std\variant.d	488"

I quickly changed that line in variant.do to "static if 
(is(typeof(zis.length)) && is(ReturnType!(zis.length) == 
size_t))" and my code compiles.

Currently its a hack, but should it be more developed and would 
it not interfere with something else?


More information about the Digitalmars-d mailing list