3 variant questions

Christopher Wright dhasenan at gmail.com
Mon May 11 03:35:29 PDT 2009


Saaa wrote:
> How do I return a variant type in D1?
> After assessing that a variadic argument is an array, how do I check its 
> depth?
> How do I set the variable given to me through the _arguments array?
> thanks :) 

Variant func()
{
	return variant(5);
}

If you want to return something given from a runtime variadic argument 
list, neither Tango's Variant nor Phobos's Variant will work. Tango's 
Variant will get this capability soon, I hear.

There is also reflect.variant:
svn co http://felt-project.org/reflect

reflect.variant allows you to create a Variant from a void* and a 
TypeInfo, like you get with varargs.


More information about the Digitalmars-d-learn mailing list