Is there any advantage of using std::pair
over std::tuple
(or vice versa) when I need only two different types?
For example:
std::pair<int,double> foo;
std::tuple<int,double> bar;
I can name one advantage is that if I need, in future, to add a third type, std::tuple
can serve me better than pair because I have to change the std::pair
to std::tuple
or to work around it (like making a struct
that contains two of them).
By advantages, I mean performance, readability, usability, maintainability or anything...
EDIT: I am seeking an answer that address performance, readability, usability, maintainability. All of these aspects were not addressed in the answers of that question which this question is marked as duplicated of it.