c++ - Google linked_ptr implementation and usefulness of linked_ptr -


i've found interesting type of smart pointer called linked_ptr supports shared ownership without heap memory allocation, worse performance / memory overhead.

i've found 2 implementations - on doubly linked list (example implementation, has x3 memory overhead comparing raw pointer) , on cycled singly linked list (example implementation google, x2 memory overhead, asymptotically slower).

my first question is: why second implementation insert new element before copied 1 in copy constructor? taskes o(n) time, n size of list; while seems easier insert new element after, this:

void join(linked_ptr_internal const* ptr) {     next_ = ptr->next_;     ptr->next_ = this; } 

or, probably, missing something?

secondly, how useful linked_ptr? seems in case of small number of references same object. why there no implementation of it, example, in boost?

if missing something, must missing well. found googling same question because can't think of use-case linked_ptr shared_ptr wouldn't better.

this says linked_ptr deprecated unique_ptr because chromium includes c++11. understanding of semantics make lot more similar shared_ptr.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -