Get array of elements the base type from Variant

evilrat evilrat666 at gmail.com
Wed Nov 20 23:00:42 PST 2013


On Thursday, 21 November 2013 at 06:31:54 UTC, RomulT wrote:
> Yes, it a work, thank you. The problem occurs when, in Variant 
> already recorded XXX[] and it is necessary to extract the 
> IXXX[], because in the place used nothing is known about type 
> XXX.

so you need just to cast XXX[] to IXXX[] ? AFAIK arrays can't be 
casted to other types. but you can use std.conv.to to convert it.

writeln( std.conv.to!(IXXX[])(v.get!(XXX[])) );

but if you put another class derived from IXXX you can see they 
are still initial types, not IXXX as you may expect.


More information about the Digitalmars-d-learn mailing list