pair class in C++: make_pair function

pair class is used to create object pairs.


template <class Type1, class Type2> struct pair {

typedef Type1 first_type;

typedef Type2 second_type;

Type1 first;

Type2 second;


pair(const Type1 &a, const Type2 &b);

template<class M, class N> pair(const<M, N> &obj);


Types of operators used by pair class: ==, !=, <, <=, >, and >=.

make_pair function: It is a function defined by pair class and is used to create a pair object.

template <class Type1, class Type2>

pair<Type1, Type2> make_pair(const Type1 &a, const Type2 &b);

Leave a Reply