If you see on cplusplus.com, you will see that this is a pair structure:
template <class T1, class T2> struct pair { typedef T1 first_type; typedef T2 second_type; T1 first; T2 second; pair() : first(T1()), second(T2()) {} pair(const T1& x, const T2& y) : first(x), second(y) {} template <class U, class V> pair (const pair<U,V> &p) : first(p.first), second(p.second) { } }
In the same way, I would say, except for some facts: Well, starting with the fact that pairs are compatible with std containers and all this, for example, with maps. In addition, pairs have already been created and already have constructors for you.
EDIT: I also forgot to mention that you will have std :: make_pair for you, which allows you to skip the memory allocation and create your own pair in the structure, and you also have certain comparison and assignment operators.
source share