Standard C++ Library Class Reference

// print out the months
// Second Febuary is not present
cout << months << endl;
// Find the Number of days in June
months_type::iterator p = months.find(string("June"));
// print out the number of days in June
if (p != months.end())
cout << endl << *p << endl;
return 0;
}
Output :
April has 30 days
August has 31 days
December has 31 days
February has 28 days
January has 31 days
July has 31 days
June has 30 days
March has 31 days
May has 31 days
November has 30 days
October has 31 days
September has 30 days
Warning
Member function templates are used in all containers provided by the Standard Template
Library. An example of this feature is the constructor for map<Key,T,Compare,Allocator> that
takes two templated iterators:
template <class InputIterator>
map (InputIterator, InputIterator, const Compare& = Compare(),
const Allocator& = Allocator());
map also has an insert function of this type. These functions, when not restricted by compiler
limitations, allow you to use any type of input iterator as arguments. For compilers that do not
support this feature, we provide substitute functions that allow you to use an iterator obtained
from the same 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
map in the following two ways:
map<int, int, less<int> >::value_type intarray[10];
map<int, int, less<int> > first_map(intarray, intarray + 10);
map<int, int, less<int> > second_map(first_map.begin(),