Is it a Variant?

Nick Sabalausky a at a.a
Sat Oct 8 21:30:51 PDT 2011


"Steve Teale" <steve.teale at britseyeview.com> wrote in message 
news:j6r6tc$2kh7$1 at digitalmars.com...
>I think I remember seeing that std.variant is being updated.
>
> Is there some way that an efficient test could be slipped in there that
> would work in templates. The best my fuzzy brain can come up with this
> morning is not wonderful:
>
> (typeof(target).stringof.indexOf("VariantN!(maxSize)") == 0)
>

If there isn't already one, it would be easy to add:

enum is_std_variant_Variant = true;

static if(traits(_compiles, target.is_std_variant_Variant)) {}

Although I would think the language itself would have some way to check if a 
type is an instantiation of a particular templated type...




More information about the Digitalmars-d mailing list