#include <iostream>
#include <tuple>
#include <string>
// helper function to print a tuple of any size
template<class Tuple, std::size_t N>
struct TuplePrinter {
static void print(const Tuple& t)
{
TuplePrinter<Tuple, N-1>::print(t);
std::cout << ", " << std::get<N-1>(t);
}
};
template<class Tuple>
struct TuplePrinter<Tuple, 1> {
static void print(const Tuple& t)
{
std::cout << std::get<0>(t);
}
};
template<class... Args>
void print(const std::tuple<Args...>& t)
{
std::cout << "(";
TuplePrinter<decltype(t), sizeof...(Args)>::print(t);
std::cout << ")\n";
}
// end helper function
int main()
{
std::tuple<int, std::string, float> t1(10, "Test", 3.14);
int n = 7;
auto t2 = std::tuple_cat(t1, std::make_pair("Foo", "bar"), t1, std::tie(n));
n = 10;
print(t2);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHVwbGU+CiNpbmNsdWRlIDxzdHJpbmc+CiAKLy8gaGVscGVyIGZ1bmN0aW9uIHRvIHByaW50IGEgdHVwbGUgb2YgYW55IHNpemUKdGVtcGxhdGU8Y2xhc3MgVHVwbGUsIHN0ZDo6c2l6ZV90IE4+CnN0cnVjdCBUdXBsZVByaW50ZXIgewogICAgc3RhdGljIHZvaWQgcHJpbnQoY29uc3QgVHVwbGUmIHQpIAogICAgewogICAgICAgIFR1cGxlUHJpbnRlcjxUdXBsZSwgTi0xPjo6cHJpbnQodCk7CiAgICAgICAgc3RkOjpjb3V0IDw8ICIsICIgPDwgc3RkOjpnZXQ8Ti0xPih0KTsKICAgIH0KfTsKIAp0ZW1wbGF0ZTxjbGFzcyBUdXBsZT4Kc3RydWN0IFR1cGxlUHJpbnRlcjxUdXBsZSwgMT4gewogICAgc3RhdGljIHZvaWQgcHJpbnQoY29uc3QgVHVwbGUmIHQpIAogICAgewogICAgICAgIHN0ZDo6Y291dCA8PCBzdGQ6OmdldDwwPih0KTsKICAgIH0KfTsKIAp0ZW1wbGF0ZTxjbGFzcy4uLiBBcmdzPgp2b2lkIHByaW50KGNvbnN0IHN0ZDo6dHVwb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