Why does std.variant not have a tag?

Era Scarecrow rtcvb32 at yahoo.com
Mon Nov 5 14:04:04 PST 2012


On Sunday, 4 November 2012 at 22:31:56 UTC, evansl wrote:
> Yet, the wiki page:
>   http://en.wikipedia.org/wiki/Tagged_union
> says:
>   a tag field explicitly indicates which one is in use.
>
> and I don't see any indication of a tag field in the 
> std_variant.html

  I remember a while back asking about the variant. I wanted to be 
able to specify an area in memory and say 'this is xxx', but 
couldn't; This was to help avoid having to manually make and 
manage something like 60 structs and far more complex code to 
manage that.

  This leads me to develop my own version (for built-in types); My 
version isn't anywhere complete (or clean enough) for 
publication, but enough for my own project (as read-only use).


  Hmmm curiously enough, i might be able to convert/rebuild by 
using a polymorphic struct that I'm tinkering with, but that 
seems like a lot of extra work.


More information about the Digitalmars-d mailing list