Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-11-03 18:21:03


Joel de Guzman wrote:

> Since modern boost libraries with a typelist interface such as tuples
> and variant use MPL anyway, it would be nice to expose a typelist
> typedef so that people can get the typelist and process it using MPL.
[snip]

I wholeheartedly agree. In fact,

   variant<T1,T2,...,TN>::types

exposes an MPL typesequence containing the logical types of the variant.

Thus, for instance,

   mpl::equal<
       variant< int, std::string >::types
     , mpl::vector2< int, std::string >
>

or

   mpl::equal<
       variant< int, recursive_wrapper< X > >::types
     , mpl::vector2< int, X >
>

However, ...

David Abrahams wrote:

> Ahem. Tuples should already be functioning mpl type sequences, IMO.
> It would be nice if variant would be the same. If not possible in
> either case for some reason, there should be a *non-intrusive*
> type_sequence<X>::type metafunction invocation which gets the type
> sequence.

No offense, but I believe it is a *terrible* idea for any type to have
the dual meanings of 'type sequence' and 'value type'. I've raised this
before; see http://lists.boost.org/MailArchives/boost/msg46807.php.

As always, please feel to tell me if/why I'm wrong.

Thanks,
Eric


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