|
| irr_ptr () |
|
| irr_ptr (std::nullptr_t) noexcept |
|
| irr_ptr (const irr_ptr &b) noexcept |
|
| irr_ptr (irr_ptr &&b) noexcept |
|
template<typename B , class = typename std::enable_if<std::is_convertible<B *, ReferenceCounted *>::value>::type> |
| irr_ptr (const irr_ptr< B > &b) noexcept |
|
template<typename B , class = typename std::enable_if<std::is_convertible<B *, ReferenceCounted *>::value>::type> |
| irr_ptr (irr_ptr< B > &&b) noexcept |
|
| irr_ptr (ReferenceCounted *object) noexcept |
| Constructs a shared pointer out of a plain one to control object lifetime.
|
|
| ~irr_ptr () |
|
irr_ptr & | operator= (const irr_ptr &b) noexcept |
|
irr_ptr & | operator= (irr_ptr &&b) noexcept |
|
template<typename B , class = typename std::enable_if<std::is_convertible<B *, ReferenceCounted *>::value>::type> |
irr_ptr & | operator= (const irr_ptr< B > &b) noexcept |
|
template<typename B , class = typename std::enable_if<std::is_convertible<B *, ReferenceCounted *>::value>::type> |
irr_ptr & | operator= (irr_ptr< B > &&b) noexcept |
|
ReferenceCounted & | operator* () const noexcept |
|
ReferenceCounted * | operator-> () const noexcept |
|
| operator ReferenceCounted * () const noexcept |
|
| operator bool () const noexcept |
|
ReferenceCounted * | get () const noexcept |
| Returns the stored pointer.
|
|
ReferenceCounted * | release () noexcept |
| Returns the stored pointer, erasing it from this class.
|
|
void | reset (ReferenceCounted *object=nullptr) noexcept |
| Drops stored pointer replacing it with the given one.
|
|
void | grab (ReferenceCounted *object) noexcept |
| Drops stored pointer replacing it with the given one.
|
|
template<class ReferenceCounted, class = typename std::enable_if<std::is_base_of<IReferenceCounted, ReferenceCounted>::value>::type>
class irr_ptr< ReferenceCounted, class >
Shared pointer for IrrLicht objects.
It should only be used for user-managed objects, i.e. those created with the new
operator or create*
functions, like: irr_ptr<scene::IMeshBuffer> buf{new scene::SMeshBuffer()};
The reference counting is not balanced as new objects have reference count set to one, and the irr_ptr
constructor (and reset
) assumes ownership of that reference.
It shouldn’t be used for engine-managed objects, including those created with addTexture
and similar methods. Constructing irr_ptr
directly from such object is a bug and may lead to a crash. Indirect construction is possible though; see the grab
free function for details and use cases.
template<class ReferenceCounted , class = typename std::enable_if<std::is_base_of<IReferenceCounted, ReferenceCounted>::value>::type>
template<typename B , class = typename std::enable_if<std::is_convertible<B *, ReferenceCounted *>::value>::type>
template<class ReferenceCounted , class = typename std::enable_if<std::is_base_of<IReferenceCounted, ReferenceCounted>::value>::type>
void irr_ptr< ReferenceCounted, class >::grab |
( |
ReferenceCounted * | object | ) |
|
|
inlinenoexcept |
Drops stored pointer replacing it with the given one.
- Note
- Copy semantics: reference counter is increased.
References irr_ptr< ReferenceCounted, class >::reset().
Referenced by irr_ptr< ReferenceCounted, class >::irr_ptr(), irr_ptr< ReferenceCounted, class >::irr_ptr(), GUIModalMenu::enter(), grab(), irr_ptr< ReferenceCounted, class >::operator=(), irr_ptr< ReferenceCounted, class >::operator=(), and GUIModalMenu::preprocessEvent().
template<class ReferenceCounted , class = typename std::enable_if<std::is_base_of<IReferenceCounted, ReferenceCounted>::value>::type>
template<typename B , class = typename std::enable_if<std::is_convertible<B *, ReferenceCounted *>::value>::type>
template<class ReferenceCounted , class = typename std::enable_if<std::is_base_of<IReferenceCounted, ReferenceCounted>::value>::type>
template<typename B , class = typename std::enable_if<std::is_convertible<B *, ReferenceCounted *>::value>::type>
template<class ReferenceCounted , class = typename std::enable_if<std::is_base_of<IReferenceCounted, ReferenceCounted>::value>::type>
void irr_ptr< ReferenceCounted, class >::reset |
( |
ReferenceCounted * | object = nullptr | ) |
|
|
inlinenoexcept |
Drops stored pointer replacing it with the given one.
- Note
- Move semantics: reference counter is not increased.
References irr_ptr< ReferenceCounted, class >::value.
Referenced by Clouds::Clouds(), GUIEngine::GUIEngine(), irr_ptr< ReferenceCounted, class >::irr_ptr(), irr_ptr< ReferenceCounted, class >::irr_ptr(), irr_ptr< ReferenceCounted, class >::irr_ptr(), GUIEngine::~GUIEngine(), irr_ptr< ReferenceCounted, class >::~irr_ptr(), irr_ptr< ReferenceCounted, class >::grab(), GUIModalMenu::leave(), irr_ptr< ReferenceCounted, class >::operator=(), irr_ptr< ReferenceCounted, class >::operator=(), GUIModalMenu::preprocessEvent(), GUIFormSpecMenu::regenerateGui(), and Sky::updateStars().