
std::tuple 1/3
std::tuple ( <tuple> ) is a fixed-size collection of heterogeneous values. It is a
generalization of std::pair . It allows any number of values
Construct a std::tuple of size 3
# include <tuple>
std::tuple tuple1(value1, value2, value3); // C++17 CTAD
std::tuple<T1, T2, T3> tuple2(value1, value2, value3);
std::tuple<T1, T2, T3> tuple3 = {value1, value2, value3};
auto tuple4 = std::make_tuple(value1, value2, value3);
Get data members
std::get<I>(tuple); // returns the I-th value of the tuple
std::get<type>(tuple); // returns the tuple element with given type
// (compiles only if that type is unique)
Other methods: comparison ==, <, >, ≥, ≤ , swap std::swap
70/88