This question already has an answer here:
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...
Aucun commentaire:
Enregistrer un commentaire