Creating a non-thread safe shared_ptr

Andrei Alexandrescu talked about implementing your own single threaded shared pointer class (with some additional optimizations) at the CppCon 2014

See the video here

And the slides here

I really think the standard or boost should supply a template parameter for using atomic ref counting in their shared ptrs though...


you could use intrusive_ptr, as it allows you to provide your own reference counting. If that reference counting is a simple increment/decrement of a variable you probably won't get any better performance than that.

Tags:

C++

Stl

Boost