al said:
When should use multimap?
map template is as below:
namespace std {
template<class Key, class T, class Pred, class A>
class map;
What are "class Pred" and "class A" for?
As a good rule of thumb never ever look at the standard headers.
They are not designed to be self documenting and may include extensions to
the standard which, if you use them, will make your code non-portable (In
particular I believe that implementations are allowed to add additional
defaulted template parameters).
This warning is particularly relevant to using the STL as alot of stuff is
not defined in the header at all such as what it means to be an acceptable
iterator to an STL algorithm - this is a particular problem of all
templates - they are largely defined by descriptions of behaviour rather
than code.
If you do the right thing and read the docs/manual pages then you will not
have to ask questions like this and you will write portable, standard
compliant C++.
If you are just poking around for curiosity's sake then I suggest you look
at
http://www.dinkumware.com/refxcpp.html which gives the documentation for
dinkumwares C++ library implementation. This isn't a definition of the
standard but it is probably close enough for you.
When not to use STL at all?
If you're compiler is lousy at inlining then the STL generated code will be
truly awful (too many trivial function calls).
I had a conflict once where I was not supposed to use optimization and yet
the compiler would not inline enough without it. In the end I got a waiver
to turn optimization on.