"Michael DOUBEZ" <mi************@free.frwrote in message
news:46***********************@news.free.fr...
: Ivan Vecerina a écrit :
: "desktop" <ff*@sss.comwrote in message
: news:f5**********@news.net.uni-c.dk...
: : set, map, multiset and multimap are all associative containers.
But
: : what does the word "associative" have to do with these 4
containers?
: >
: Good question :)
: >
: I think that the name comes from the fact that each element stored
: within the container is "associated" with a key, from the element
: can be retrieved.
: >
: Of course, set and multiset do not explicitly store additional data
: along with the key itself - they're therefore a bit of a degenerate
: case. Yet you will often seen std::set used with an element type
that
: stores more data than the key itself, and a custom Comparator.
:
: In fact, for set and multiset, the element is the key itself. This is
: why values are const in set and multiset.
They are (now) required to be, athough this was not the case in the
original 1998 C++ standard, but was later debated and settled --
limiting some possible (-/mis/ab)uses of std::set and std::multiset.
For those interested:
http://www.open-std.org/jtc1/sc22/wg...fects.html#103
For instance, the current MSVC2005+SP1 still allows std::set key
modification...
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form