JustSomeGuy said:
in the stl map class I see the use of a function pair
'std:
air' is not a function, it's a type.
and make_pair.
What is the difference between pair and make_pair?
'std:
air' is a type, 'std::make_pair' is a function.
dictionary.insert(std:
air<Key, Value>(k,v));
works as well as:
dictionary.insert(std::make_pair<Key, Value>(k,v));
============================================================
ISO/IEC 14882:1998(E)
[....]
20.2.2 Pairs
1 The library provides a template for heterogeneous pairs of
values. The library also provides a matching template function
to simplify their construction.
template <class T1, class T2>
struct pair {
typedef T1 first_type;
typedef T2 second_type;
T1 first;
T2 second;
pair();
pair(const T1& x, const T2& y);
template<class U, class V> pair(const pair< U, V> & p);
};
[....]
template <class T1, class T2>
pair<T1, T2> make_pair(const T1& x, const T2& y);
7 Returns: pair<T1, T2>(x, y).
8 [Example: In place of:
return pair<int, double>(5, 3.1415926); // explicit types
a C++ program may contain:
return make_pair(5, 3.1415926); // types are deduced
--end example]
[....]
============================================================
-Mike