mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 07:33:57 +00:00
[C++/en] Tuple , Updated
This commit is contained in:
parent
4a1a6857ce
commit
fa2b171008
@ -967,10 +967,10 @@ v.swap(vector<Foo>());
|
||||
|
||||
// We start with constructing a tuple.
|
||||
// Packing values into tuple
|
||||
auto first = make_tuple(10,'A') ;
|
||||
auto first = make_tuple(10,'A');
|
||||
const int maxN = 1e9;
|
||||
const int maxL = 15;
|
||||
auto second = make_tuple(maxN,maxL) ;
|
||||
auto second = make_tuple(maxN,maxL);
|
||||
|
||||
// printing elements of 'first' tuple
|
||||
cout << get<0>(first) << " " << get<1>(first) << "\n"; //prints : 10 A
|
||||
@ -978,7 +978,6 @@ cout << get<0>(first) << " " << get<1>(first) << "\n"; //prints : 10 A
|
||||
// printing elements of 'second' tuple
|
||||
cout << get<0>(second) << " " << get<1>(second) << "\n"; // prints: 1000000000 15
|
||||
|
||||
|
||||
// Unpacking tuple into variables
|
||||
|
||||
int first_int;
|
||||
|
Loading…
Reference in New Issue
Block a user