This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]