Please enable JavaScript.
Coggle requires JavaScript to display documents.
cpp_tuple (tie (ignore (std::tie(x, std::ignore, z) = t2; // get<1>…
cpp_tuple
tie
1/3: t2 = make_tuple(12, "dog", 'g');
-
3/3: std::make_tuple(std::ref(x), std::ref(y), std::ref(z)) = t2; // assign t2 to x, y, z
std::tie(x,y,z) = t2; // same thing
ignore
std::tie(x, std::ignore, z) = t2; // get<1>(t2) is ignored
get
we cannot loop over j, get<j>(t)
get<0>(t), get<1>(t), get<2>(t)
-
-
comparison
1/2: tuple<int, int, int> time1, time2; // hours, minutes, seconds
-
-
multi-index-map
1/2: map<tuple<int,int,int>, string> timemap;
2/2: timemap.insert(make_pair(make_tuple(12, 2, 3), "run"));
timemap[make_tuple(2,3,4)];
struct vs tuple
-
if comparison needed, tuple can be helpful as below
-
tuple
tuple<int, string, char> ttt; // default construction
tuple<int, string, char> t(32, "tea", 'a');
make_tuple
ttt = make_tuple(10, "after default contt", 'E');
-
tuple_cat
-
/2: auto t4 = std::tuple_cat( t2, t3 );
-
-