David Abrahams wrote:
> That's not (I think) what Alexander had in mind: IIUC he was talking
> about a wrapper over tuples such that:
>
>       tuple_sequence<some_tuple>
>
> is an MPL sequence.  Of course, a better solution would be to
> specialize begin/end so that any Boost tuple is *itself* an MPL
> sequence.

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?

Thanks,
Eric



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to