EnableSharedFromThis.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <vector>
9 #include <mutex>
10 #include <ememory/SharedPtr.hpp>
11 #include <ememory/WeakPtr.hpp>
12 
13 
14 namespace ememory {
22  template<typename EMEMORY_TYPE>
24  private:
25  mutable ememory::WeakPtr<EMEMORY_TYPE> m_weakThis;
26  protected:
34  virtual ~EnableSharedFromThis() = default;
35  public:
40  ememory::SharedPtr<EMEMORY_TYPE> sharedFromThis();
45  const ememory::SharedPtr<EMEMORY_TYPE> sharedFromThis() const;
50  ememory::WeakPtr<EMEMORY_TYPE> weakFromThis();
55  const ememory::WeakPtr<EMEMORY_TYPE> weakFromThis() const;
56  };
57 }
58 
59 #include <ememory/details/EnableSharedFromThis.hxx>
60 
WeakPtr is an interface that lose the data pointer when all SharedPtr as been released.
Definition: SharedPtr.hpp:15
Basic handle to be simplify at the basic mode of the onject recognition for internal tamplate filter ...
Definition: EnableSharedFromThis.hpp:18
Enable the acces of the self sharedPtr inside an object (note: not availlable in contructor and destr...
Definition: EnableSharedFromThis.hpp:23
Ememory is a namespace to represent the.
Definition: Counter.hpp:14
ememory::SharedPtr is a smart pointer that retains shared ownership of an object through a pointer...
Definition: SharedPtr.hpp:34