function template

std::tuple_cat

<tuple>
template <class... Tuples>
  tuple<CTypes...> tuple_cat (Tuples&&... tpls);
Concatenate tuples
Constructs an object of the appropriate tuple type to contain a concatenation of the elements of all the tuples in tpls, in the same order.

Each element in the returned tuple is copy/move constructed.

Parameters

tpls
Comma-separated list of tuple objects. These may be of different types.

Return Value

A tuple object of the appropriate type to hold args.

The type of the returned object (tuple<CTypes...>) is the tuple type that contains the ordered sequence of all the extended types in Tuples.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// tuple_cat
#include <iostream>
#include <utility>
#include <string>
#include <tuple>

int main ()
{

  std::tuple<float,std::string> mytuple (3.14,"pi");
  std::pair<int,char> mypair (10,'a');

  auto myauto = std::tuple_cat ( mytuple, mypair );

  std::cout << "myauto contains: " << std::endl;
  std::cout << std::get<0>(myauto) << std::endl;
  std::cout << std::get<1>(myauto) << std::endl;
  std::cout << std::get<2>(myauto) << std::endl;
  std::cout << std::get<3>(myauto) << std::endl;

  return 0;
}


Output:
myauto contains:
3.14
pi
10
a

See also