Get array of elements the base type from Variant

RomulT romu777 at bk.ru
Thu Nov 21 00:04:48 PST 2013


On Thursday, 21 November 2013 at 07:00:43 UTC, evilrat wrote:
> 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.

I rather had in view that's - http://dpaste.dzfl.pl/43290b8c, 
probably Variant has the limited realization.


More information about the Digitalmars-d-learn mailing list