Standard C++ Library Class Reference
type of container as the one you are constructing (or calling a member function on), or you can use a
pointer to the type of element you have in the container.
For example, if your compiler does not support member function templates you can construct a set in
the following two ways:
int intarray[10];
set<int, less<int>, allocator> first_set(intarray, intarray + 10);
set<int, less<int>, allocator> second_set(first_set.begin(),
first_set.end());
but not this way:
set<long, less<long>, allocator> long_set(first_set.begin(),
first_set.end());
since the long_set and first_set are not the same type.
Also, many compilers do not support default template arguments. If your compiler is one of these you
need to always supply the Compare template argument, and the Allocator template argument. For
instance, you need to write :
set<int, less<int>, allocator>
instead of :
set<int>
See Also
allocator, Bidirectional Iterators, Containers, lexicographical_compare