I've been playing around with variadic templates and noticed the following.
This works fine:
auto t = std::make_tuple(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
This will give the error (gcc 4.8.2 (edit: Clang 3.4) has maximum depth of 256 by default):
auto t2 = std::make_tuple(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17);
However, creating the tuple directly will work:
std::tuple<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int> t3(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17);
I noticed this while trying to create a templated function that returns a templated class.
template <typename...Arguments>
struct Testing {
std::tuple<Arguments...> t;
Testing(Arguments...args) : t(args...) {}
};
template <typename... Arguments>
Testing<Arguments...> create(Arguments... args) {
return Testing<Arguments...>(args...);
}
In this case, this will work:
auto t4 = create(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
and this won't:
auto t5 = create(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17);