Get array of elements the base type from Variant

evilrat evilrat666 at gmail.com
Wed Nov 20 21:44:51 PST 2013


On Thursday, 21 November 2013 at 05:16:10 UTC, RomulT wrote:
> Hi, help please, how I get array of elements the base type from 
> Variant?
>
>
> http://dpaste.dzfl.pl/6dd70f9b

may be there is a way to cast array directly but i doubt.

so you need either to do this

	IXXX[] x = [new XXX(), new XXX()];
	Variant v = x;
	writeln(v.get!(IXXX[]));

or cast all members of original array to its base type

	XXX[] x = [new XXX(), new XXX()];
	Variant v = x;

	foreach( ixx ; v.get!(XXX[]) )
	  writeln(cast(IXXX)ixx.get());


More information about the Digitalmars-d-learn mailing list