Boost logo

Boost :

From: Itay Maman (itay_maman_at_[hidden])
Date: 2002-06-13 18:54:18


I'd like to address some issues:

1. should all types be different?
Seems like a reasonable requirement

2. Is direct recursion (i.e: variant<int, rec>) allowed?
I think we should not allow instantiations like this:
        variant<int, rec> v1;

3. Policies
Doug has made some serious points against conversion policies. I do
agree with him. Anyway, variant's user will always be able to get whatever
conversion effect he needs by writing a suitable visitor.

As for the storage policy, I do find it is useful (to the same extent as
allocators...) but I am willing to drop that as well on practical
grounds: (1)
It will only be used in extremely rare cases. (2) Combining a default
template
parameter with a non type-list interface will (unjustifably) complicate
variant's Instantiation interface.

The conversion behavior should use overload resolution rules.

4. Instantiation interface
We should support both options, i.e:

    template<
       typename T1, typename T2 = Unused_tag, typename, T3 =
unused_tag,...>
    class variant;

- and -

    template<typename H, typename T>
    class variant<TypeList<H,T> >;

In either option, variant's internal implementation should be
TypeLists-based.

-Itay


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