std::shared_ptr vs allocators: by value or by const ref?!?

Paolo Carlini
Fri Oct 8 11:31:00 GMT 2010

Hi all, hi Jon,

does anybody know what the heck is going on about allocator passing? We
have allocate_shared taking the allocator by const ref, whereas the
constructors, at variance with the rest of the library AFAICS,  take it
by value. Then in our implementation, at variance with the current
C++0x, shared_ptr::reset takes it by const ref only to pass it
immediately to a by value constructor, also we internally use by const
ref in many other places. For sure, I have been able to change our impl
to consistently use by const ref everywhere and apparently nothing
breaks, and I don't see why it should: when a mutable allocator is
required it is always constructed in the body of the various functions
from the argument. Is there an open DR about this, Jon?


More information about the Libstdc++ mailing list