#include <iostream>
#include <utility>
#include <tuple>
class Test
{
public:
Test(std::tuple<int, float>) {
std::cout << "Test::Test(tuple)" << std::endl;
}
template <typename... Args>
Test(Args... args) {
std::cout << "Test::Test(args...)" << std::endl;
}
};
int main()
{
// create tuple
std::tuple<int, float> tpl(98, 3.14);
// pass tuple to the constructor
std::pair<int, Test> pr1(185, tpl);
// pass tuple elements to the constructor
std::pair<int, Test> pr2(std::piecewise_construct, std::make_tuple(185), tpl);
return 0;
}
/*
run:
Test::Test(tuple)
Test::Test(args...)
*/