I'm not sure if Boost.Tuple has such a feature, maybe Boost.Fusion will be more suitable for your needs.
However, if you have a compiler that supports C ++ 11 variable templates, you can switch to std::tuple and write a small replacement to add the type to the existing tuple:
template <typename Container, typename T> struct push_back; template <template <typename...> class Container, typename T, typename... Args> struct push_back<Container<Args...>, T> { typedef Container<Args..., T> type; }; typedef std::tuple<int, double> myTuple; typedef push_back<myTuple, bool>::type myOtherTuple; myOtherTuple(1, 0.0, true);
The same can be done for boost::tuple , but it would be a lot of tedious writing.
source share