Given:
typedef boost::tuple< T1, T2, T3, ..., Tn > Tuple_Tn
where the types T1, ... Tn are all defined,
And given type T_another, I'd like to define a new tuple type:
typedef boost::tuple< T1, T2, T3, ..., Tn, T_another > Tuple_T_plus_1
But here is my problem: in the place where I want to define it I only have access to types Tuple_Tn and T_another.
In other words, Is it possible to define Tuple_T_plus_1 in terms of Tuple_Tn and T_another only?
I'm not sure there is such a feature in Boost.Tuple, perhaps Boost.Fusion would be more suited for your needs.
However, if you have a compiler supporting C++11 variadic templates, you can switch to
std::tuple
and write a small metafunction for appending a type to an existing tuple:The same thing can be achieved for
boost::tuple
, but would be much more tedious to write.