Example of make_tuple()
// C++ program to illustrate
// std::make_tuple() function in C++
#include <iostream>
#include <tuple>
using namespace std;
int main()
{
// Tuple Declared and Initialized using make_tuple()
auto t1 = make_tuple(1, "w3wiki", 'g');
// Tuple Printed
cout << "Tuple: " << get<0>(t1) << ", " << get<1>(t1)
<< ", " << get<2>(t1);
return 0;
}
Output
Tuple: 1, w3wiki, g
std::make_tuple() in C++
In C++, std::make_tuple() is a standard library function that constructs an object of std::tuple type using the arguments given to it. It can take any number and type of argument and create a tuple object by automatically deducing the type of the argument. It is defined inside the <utility> header file as a function template.