Boost logo

Boost :

From: Martin Wille (mw8329_at_[hidden])
Date: 2002-07-02 04:34:02

Itay Maman wrote:

> David Abrahams wrote:
> > In particular, I think of a cast as generally being
> > a peer-to-peer type transformation, whereas these "casts" are
> > container-to-containee transformations. I was thinking of "extract":
> >
> > extract<int>(obj)
> >
> > Now, "extract<>" might be too-general a name to use in namespace
> > boost, but I'm not sure that it is. I do think it works better
> > than "variant_cast<>".
> >
> > Thoughts?
> > Dave
> >
> The Inheritance relationship is also a composition. So, the upcast of a
> class D to its base class B, may also be referred to as 'extracting' B
> out of D. Nonethless, this primitive is widely known as casting.
> I think the same logic should be applied here: Althought we are actually
> extracting a held value, we may still use 'variant_cast' to describe the
> operation.
> -Itay

A variant basically is a union (be it typesafe or not). The process
of interpreting a unions value as of being of a specific type can be
referred to as putting a view onto it. So, view<>, view_as<> or even
as<> might be fitting names. Prefixing these with "variant_" might
make sense.


Do You Yahoo!?
Get your free address at

Boost list run by bdawes at, gregod at, cpdaniel at, john at