Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

unpack tuple c++

auto tuple = std::make_tuple(1, 'a', 2.3);
std::array<int, 3> a{1, 2, 3};

// unpack the tuple into individual variables declared above
const auto[i, c, d] = tuple;
// same with an array
auto[x,y,z] = a;
Source by dominikberner.ch #
 
PREVIOUS NEXT
Tagged: #unpack #tuple
ADD COMMENT
Topic
Name
4+1 =