digitalmars.D - Is it a Variant?
- Steve Teale (6/6) Oct 08 2011 I think I remember seeing that std.variant is being updated.
- Nick Sabalausky (7/12) Oct 08 2011 If there isn't already one, it would be easy to add:
- Robert Jacques (4/10) Oct 08 2011 Yes, there is. Variant is now a struct so:
- Steve Teale (2/7) Oct 09 2011 So it does. Thanks.
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
Oct 08 2011
"Steve Teale" <steve.teale britseyeview.com> wrote in message news:j6r6tc$2kh7$1 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...
Oct 08 2011
On Sun, 09 Oct 2011 00:11:24 -0400, Steve Teale <steve.teale 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) SteveYes, there is. Variant is now a struct so: is(typeof(target)==Variant) works just like you'd expect.
Oct 08 2011
On Sun, 09 Oct 2011 01:39:10 -0400, Robert Jacques wrote:Yes, there is. Variant is now a struct so: is(typeof(target)==Variant) works just like you'd expect.So it does. Thanks.
Oct 09 2011