Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template enable_shared_from_this

boost::interprocess::enable_shared_from_this

Synopsis

// In header: <boost/interprocess/smart_ptr/shared_ptr.hpp>

template<typename T, typename VoidAllocator, typename Deleter> 
class enable_shared_from_this {
public:

  // public member functions
  shared_ptr< T, A, D > shared_from_this();
  shared_ptr< T const, A, D > shared_from_this() const;
};

Description

This class is used as a base class that allows a shared_ptr to the current object to be obtained from within a member function. enable_shared_from_this defines two member functions called shared_from_this that return a shared_ptr<T> and shared_ptr<T const>, depending on constness, to this.

enable_shared_from_this public member functions

  1. shared_ptr< T, A, D > shared_from_this();
  2. shared_ptr< T const, A, D > shared_from_this() const;

PrevUpHomeNext