Is it a Variant?

Robert Jacques sandford at jhu.edu
Sat Oct 8 22:39:10 PDT 2011


On Sun, 09 Oct 2011 00:11:24 -0400, Steve Teale <steve.teale at britseyeview.com> wrote:
> 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)
>
> Steve
>

Yes, there is. Variant is now a struct so:

is(typeof(target)==Variant)

works just like you'd expect.


More information about the Digitalmars-d mailing list