templates

Philippe Sigaud philippe.sigaud at gmail.com
Mon Apr 19 13:56:33 PDT 2010


On Mon, Apr 19, 2010 at 21:52, Ali Çehreli <acehreli at yahoo.com> wrote:

> Ellery Newcomer wrote:
>
>> I want to be able to store heterogeneous T!(S) in a single list
>>
>
> std.boxer or std.variant may be useful:
>
>  http://digitalmars.com/d/2.0/phobos/std_boxer.html
>
>  http://digitalmars.com/d/2.0/phobos/std_variant.html
>
> Ali
>

But how do you get back what was stored inside a Variant without any
indication as to what it was initially?
As far as I get it, Variant is useful to have a variable that can be
assigned with many other variables of different types during its lifetime.

I also regularly want to use it to store _one_ thing, anything, to get it
back later. But then I'm at a loss as to how crack open the Variant
afterwards, without storing some sort of type information somewhere.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100419/9a31bf34/attachment.html>


More information about the Digitalmars-d-learn mailing list