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: Some questions on allocators and shared_ptr


Jonathan Wakely <jwakely.gcc <at> gmail.com> writes:

> 
> Right, which makes me more certain shared_ptr isn't ideal for this purpose.
> 
> The second count kept for weak_ptr support isn't needed, and
> shared_ptr only needs to allocate memory to support the weak count as
> a separate object.  If you don't need that feature, adding
> non-standard extensions to workaround it's consequences seems wrong.
> 
> I would stick to a design without shared_ptr, storing an allocator and
> (intrusive) reference count in the nodes.
> 

I was under an impression, that having multiple implementations of reference
counts is not the best idea around (as of now, existing rope, basic_string and
vstring all have it manually implemented).

I will probably try to make use of Sp_counted_base directly, saving myself at
least part of the trouble (and may be I'll find a use for weak_count as well).



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