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
http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/index.h...
which was recently accepted into Boost.
I will read it, thanks. It looks great! Thanks, Adrián