xentara-plugin v2.0.4
The Xentara Plugin Framework
|
A mixin class that enables getting a shared pointer from the this pointer. More...
#include <xentara/skill/EnableSharedFromThis.hpp>
Public Member Functions | |
constexpr | EnableSharedFromThis () noexcept=default |
Default constructor. | |
EnableSharedFromThis (const EnableSharedFromThis &) noexcept | |
Dummy copy constructor that does not copy anything. | |
auto | operator= (const EnableSharedFromThis &) noexcept -> EnableSharedFromThis & |
Dummy assignment operator that does nothing. | |
auto | sharedFromThis () -> std::shared_ptr< Derived > |
Creates a shared pointer for this object. | |
auto | sharedFromThis () const -> std::shared_ptr< const Derived > |
Creates a constant shared pointer for this object. | |
auto | weakFromThis () -> std::weak_ptr< Derived > |
Creates a weak pointer for this object. | |
auto | weakFromThis () const -> std::weak_ptr< const Derived > |
Creates a constant weak pointer for this object. | |
Protected Member Functions | |
template<typename Alias > | |
auto | sharedFromThis (Alias *alias) const -> std::shared_ptr< Alias > |
Creates an aliasing shared pointer for an arbitrary alias object. | |
A mixin class that enables getting a shared pointer from the this pointer.
This class is similar to std::enable_shared_from_this, except that it is designed especially for Xentara skill elements. It works together with xentara::skill::ElementFactory in the same way as std::enable_shared_from_this works together with std::make_shared().
Additionally, this class has a convenience function
|
constexprdefaultnoexcept |
Default constructor.
|
noexcept |
Dummy copy constructor that does not copy anything.
|
noexcept |
Dummy assignment operator that does nothing.
auto xentara::skill::EnableSharedFromThis< Derived >::sharedFromThis | ( | ) | -> std::shared_ptr<Derived> |
Creates a shared pointer for this object.
auto xentara::skill::EnableSharedFromThis< Derived >::sharedFromThis | ( | ) | const -> std::shared_ptr<const Derived> |
Creates a constant shared pointer for this object.
|
protected |
Creates an aliasing shared pointer for an arbitrary alias object.
This function uses the aliasing constructor (8) of std::shared_ptr to create a shared pointer to an arbitrary second object that shares ownership information with this object. This is usually done to create a shared pointer to a member variable of this object.
alias | The alias object that the pointer should point to. The lifetime of the alias object must be at least as least as long as the lifetime of this object. |
auto xentara::skill::EnableSharedFromThis< Derived >::weakFromThis | ( | ) | -> std::weak_ptr<Derived> |
Creates a weak pointer for this object.
auto xentara::skill::EnableSharedFromThis< Derived >::weakFromThis | ( | ) | const -> std::weak_ptr<const Derived> |
Creates a constant weak pointer for this object.