#include <tuple>
#include <iostream>
#include <type_traits>
template <size_t n, typename... T>
typename std::enable_if<(n >= sizeof...(T))>::type
print_tuple(std::ostream&, const std::tuple<T...>&)
{}
template <size_t n, typename... T>
typename std::enable_if<(n < sizeof...(T))>::type
print_tuple(std::ostream& os, const std::tuple<T...>& tup)
{
if (n != 0)
os << ", ";
os << std::get<n>(tup);
print_tuple<n+1>(os, tup);
}
template <typename... T>
std::ostream& operator<<(std::ostream& os, const std::tuple<T...>& tup)
{
os << "[";
print_tuple<0>(os, tup);
return os << "]";
}
int main()
{
std::cout << std::make_tuple(2, 3.14159F, 2345.678) << std::endl;
std::cout << std::make_tuple("hello", 5) << std::endl;
std::cout << std::make_tuple() << std::endl;
return 0;
}
I2luY2x1ZGUgPHR1cGxlPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDx0eXBlX3RyYWl0cz4KCnRlbXBsYXRlIDxzaXplX3QgbiwgdHlwZW5hbWUuLi4gVD4KdHlwZW5hbWUgc3RkOjplbmFibGVfaWY8KG4gPj0gc2l6ZW9mLi4uKFQpKT46OnR5cGUKICAgIHByaW50X3R1cGxlKHN0ZDo6b3N0cmVhbSYsIGNvbnN0IHN0ZDo6dHVwbGU8VC4uLj4mKQp7fQoKdGVtcGxhdGUgPHNpemVfdCBuLCB0eXBlbmFtZS4uLiBUPgp0eXBlbmFtZSBzdGQ6OmVuYWJsZV9pZjwobiA8IHNpemVvZi4uLihUKSk+Ojp0eXBlCiAgICBwcmludF90dXBsZShzdGQ6Om9zdHJlYW0mIG9zLCBjb25zdCBzdGQ6OnR1cGxlPFQuLi4+JiB0dXApCnsKICAgIGlmIChuICE9IDApCiAgICAgICAgb3MgPDwgIiwgIjsKICAgIG9zIDw8IHN0ZDo6Z2V0PG4+KHR1cCk7CiAgICBwcmludF90dXBsZTxuKzE+KG9zLCB0dXApOwp9Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUuLi4gVD4Kc3RkOjpvc3RyZWFtJiBvcGVyYXR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