Is there a difference between an std::pair and an std::tuple with only two members? (Besides the obvious that std::pair requires two and only two members and tuple may have more or less...)
Is there a difference between an std::pair and an std::tuple with only two members? (Besides the obvious that std::pair requires two and only two members and tuple may have more or less...)
Note that with C++ 17, one can use the same interface to read data from both pair and tuple with two elements.
auto [a, b] = FunctionToReturnPairOrTuple();
No need to use get<> :)
It is, perhaps, worth noting that cppreference states:
"A pair is a specific case of a std::tuple with two elements."