=====insert=====
Syntax:
#include
iterator insert( iterator pos, const TYPE& val );
iterator insert( const TYPE& val );
void insert( input_iterator start, input_iterator end );
The function insert() either:
* inserts val after the element at pos (where pos is really just a suggestion as to where val should go, since multisets and multimaps are ordered), and returns an iterator to that element.
* inserts val into the multiset, returning an iterator to the element inserted.
* inserts a range of elements from start to end.
For example, the following code uses insert() to add elements to a multiset:
multiset ms;
multiset::iterator iter;
int i;
for (i = 1; i < 5; i++) {
ms.insert(i);
ms.insert(i*i);
ms.insert(i-1);
}
cout << "ms is:" ;
for (iter = ms.begin(); iter != ms.end(); iter++)
cout << " " << *iter;
cout << "." << endl;
The above code produces the following output:
ms is: 0 1 1 1 2 2 3 3 4 4 9 16.