This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] A bit of rationale about C++0x shared_ptr vs allocators
Paolo Carlini:
Humm, replying to myself, sorry...
Is it possible to have a bit of rationale?
Now I think I see it. It's because we want eventually to call non-const
members, like allocate/deallocate. We are not seeing the issue so clearly
in our implementation because of a rebind that we have in our hierarchy...
Still, I'm puzzled that the specifications cannot be otherwise...
Yes. Note also that, in general, given move semantics, by-value arguments
that you intend to manipulate exclusively (or store) are more efficient that
const&, because calling the function with an rvalue will elide the copy
you'd have done otherwise. One would need an additional A&& overload to
optimize the rvalue case, since A const& cannot be moved-from.