[ptr_container] Why is the key passed to ptr_map by non-const reference?

23 Sep
2007
23 Sep
'07
6:53 p.m.
Before anyone refers me to the FAQ at http://www.boost.org/libs/ptr_container/doc/faq.html#why-does-ptr-map-t-inse... - I read it. While it's clear why a reference is used I don't understand why it is a *non-const* reference. Any reason why it's not const? Boris

24 Sep
24 Sep
8:01 a.m.
New subject: [ptr_container] Why is the key passed to ptr_map by non-const reference?
Boris skrev:
Before anyone refers me to the FAQ at http://www.boost.org/libs/ptr_container/doc/faq.html#why-does-ptr-map-t-inse... - I read it. While it's clear why a reference is used I don't understand why it is a *non-const* reference. Any reason why it's not const?
A temporary object can bind to a const reference, thus a call to a throwing constructor can be placed as the key argument. -Thorsten
6361
Age (days ago)
6362
Last active (days ago)
1 comments
2 participants
participants (2)
-
Boris
-
Thorsten Ottosen