cpp11/tuple.cc
Stephen M. McQuay 815175e35e finished product
2012-05-05 13:45:49 -06:00

24 lines
422 B
C++

#include <tuple>
#include <iostream>
using namespace std;
auto some_func() -> tuple<int, int> {
return make_tuple(4, 2);
}
int main() {
auto c = make_tuple(5, 4);
cout << get<0>(c) << endl;
int a = 0;
int b = 1;
tie(a, b) = make_tuple(b, a);
cout << a << endl;
cout << b << endl;
// get a,b from func ...
tie(a, b) = some_func();
cout << a << endl;
cout << b << endl;
}