function template
<tuple>
std::make_tupletemplate<class... Types> tuple<VTypes...> make_tuple (Types&&... args);
Construct tuple
Constructs an object of the appropriate tuple type to contain the elements specified in args.The type of the returned object (tuple<VTypes...>
) is deduced from Types: For each type in Types, its decay equivalent is used in VTypes (except reference_wrapper types, for which the corresponding reference type is used instead).
The function calls tuple's initialization constructor, forwarding args to it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// make_tuple example
#include <iostream>
#include <tuple>
#include <functional>
int main()
{
auto first = std::make_tuple (10,'a'); // tuple < int, char >
const int a = 0; int b[3]; // decayed types:
auto second = std::make_tuple (a,b); // tuple < int, int* >
auto third = std::make_tuple (std::ref(a),"abc"); // tuple < const int&, const char* >
std::cout << "third contains: " << std::get<0>(third);
std::cout << " and " << std::get<1>(third);
std::cout << std::endl;
return 0;
}
third contains: 0 and abc
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4