Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr and global reset
From: Alexander (gutenev_at_[hidden])
Date: 2009-02-26 04:36:56


  "Roman Perepelitsa" <roman.perepelitsa_at_[hidden]> wrote

  Common technique to reduce size of linked-list pointer is to use single linked list instead of double linked list. Copying such pointer is liner to the number of copies, but in cases where number of copies is low (i.e. in most cases) it's acceptable. The biggest advantage of linked-list pointers over shared_ptr is that they don't require additional allocation for a counter.

  Roman Perepelitsa.
If you create shared_ptr with boost::make_shared, the counter and deleter would be allocated in the same block. Linked-list pointer has no significant advantages and for multi-threaded performance it is worse than shared_ptr. It has an adnvantage for this specific task: it is possible to access all the pointers that share the ownership and reset them all.
Are there any other advantages of single-linked except space for a pointer ?



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