Boost logo

Boost :

From: Alexander Nasonov (alnsn-mycop_at_[hidden])
Date: 2003-04-30 04:41:08


Eric Friedman wrote:
> I am a bit uneasy about any proposal making adding MPL sequence semantics
> to an otherwise-typical value type. If such proposals are implemented, I
> see a significant ambiguity problem arising in generic code: given a type
> T that is an MPL sequence, should we treat it as a sequence or as a value
> type?
>
> In particular, if we were to implement boost::tuple as an MPL sequence,
> the following code would seem to me quite unclear insofar as its intended
> behavior:
>
> typedef mpl::list<int, std::string> some_types;
> typedef boost::tuple<int, std::string> some_tuple;
>
> typedef boost::variant<some_types> v1; // ok, unambiguous
> typedef boost::variant<some_tuple> v2; // ambiguity!?
>
> It seems clear that objects of type v1 should behave equivalently to
> boost::variant<int, std::string>. However, if boost::tuple were an MPL
> sequence, it seems less clear whether objects of type v2 should behave
> likewise or instead as a variant holding a 2-tuple.
>
> Thus, this question is of particular importance for boost::variant. But
> also, I imagine, it is important for any other type implementing a
> pseudo-variadic template interface as I intend for the final release of
> variant (which is coming, by the way).
>
> Input?

I agree.

-- 
Alexander Nasonov
Remove minus and all between minus and at from my e-mail for timely response

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