Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-11-17 09:02:19


Eric Friedman wrote:
> Peter Dimov wrote:
>
>> Second, if I write
>>
>> template<class Seq> void f( variant<Seq> const & v );
>>
>> my function will not match all variants. I think that the correct but
>> painful thing to do is to just drop the convenience T1..Tn form.
>
> The approach I currently recommend in the variant documentation is the
> following:
>
> template < BOOST_VARIANT_ENUM_PARAMS(typename T) >
> void f( variant<BOOST_VARIANT_ENUM_PARAMS(T)> const & v );
>
> I don't know if this is to be considered better or worse than
>
> template <typename V>
> typename enable_if< is_variant<V> >::type
> f( V const & v );

<shrug> As I said, I consider both inferior, in the long term, to
variant<Sq>. It's true that this forces the somewhat inconvenient

    variant< mpl::list<T1, T2, ...> >

syntax on users that would have preferred not to know about MPL, a point of
view I can sympathize with. Which is why I used "long term" above.


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