Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-11-15 15:45:40


On Thursday 15 November 2001 11:55 am, you wrote:
> > > I remember seeing this discussed, but I can't find any work-in-progress
> > > in the vault. Has interest died? Has everyone run out of time, or
> > > have I just missed the files?
> >
> > I believe the Any type would be what you're looking for.
>
> No, this was a seperate proposal (post any's acceptance) for a
> discriminated union class with a 'type-based' switch (vswitch).
>
> - Dale.

There have been several proposals, actually, and there is some code floating
around (see, for instance, Brian Parker's valunion).

I believe the goals for such a variant type are simple:
  1) interface similar to that of the "any" type
  2) variant has a bounded set of types it can hold, given by template
parameters.
  3) stack-alignment so that it can be as efficient as a C union
  4) allows the storage of any type

The vswitch construct I proposed would not specifically be part of the
variant type, but would work with both "any" and the variant type. It should
be considered a separate entity for now.

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk