Boost logo

Boost Users :

From: Adrián Etchevarne (aetcheva_at_[hidden])
Date: 2006-05-30 11:00:34

David Abrahams wrote:

> That's a lot easier to solve, in some sense, than the "Problem:"
> above. The cons list *is* a valid tuple. So to inserta new type at
> the front, just write
> const<T, the-shorter-cons-list>
Thanks to David and Joaquín for their response.

tuple inherit from cons, so tuple is a cons.

cons<> has an implicit conversion to tuple, but the types are not the same
(or I am missing something):

template< typename Cons, typename T>
struct p_front
        typedef cons<T, Cons> type;

typedef p_front< tuple<int>::inherited, float>::type pushed;

(is_same< pushed, tuple<float, int> >::value == false) // Not the same

If I declare

pushed value;

value has cons operations, not tuple operations. The implicit conversion
mitigates this. How I can sinthesize a tuple type? Joaquín's brute force
approach is the ultimate solution?

> You might also want to look at
> which was recently accepted into Boost.
I will read it, thanks. It looks great!


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at