Boost logo

Boost Users :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-09-24 04:01:26


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-insert-replace-take-two-arguments-the-key-and-the-pointer-instead-of-one-std-pair-and-why-is-the-key-passed-by-non-const-reference
> - 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net