tie in c 2b 2b

Solutions on MaxInterview for tie in c 2b 2b by the best coders in the world

showing results for - "tie in c 2b 2b"
Ash
29 Jun 2020
1// packing/unpacking tuples
2#include <iostream>     // std::cout
3#include <tuple>        // std::tuple, std::make_tuple, std::tie
4
5int main ()
6{
7  int myint;
8  char mychar;
9
10  std::tuple<int,float,char> mytuple;
11
12  mytuple = std::make_tuple (10, 2.6, 'a');          // packing values into tuple
13
14  std::tie (myint, std::ignore, mychar) = mytuple;   // unpacking tuple into variables
15
16  std::cout << "myint contains: " << myint << '\n';
17  std::cout << "mychar contains: " << mychar << '\n';
18
19  return 0;
20}