Axmol 3.0.0-89d6d9a
Loading...
Searching...
No Matches
WeakPtr< _Ty > Class Template Reference

WeakPtr. More...

#include <WeakPtr.h>

Detailed Description

template<typename _Ty>
class ax::WeakPtr< _Ty >

WeakPtr.

A non-owning smart pointer to an ax::Object. Unlike RefPtr, it does not increase the reference count. It becomes expired when the target Object is destroyed or recycled.

Key points:

  • Use expired() to check if the pointer has expired.
  • Use lock() to obtain a RefPtr if the object is still alive.
  • Supports comparison with raw pointers and nullptr for convenience.
  • Does not guarantee thread safety (same as ax::Object reference counting).

Typical usage:

  • Store a WeakPtr when you need to reference an Object without extending its lifetime.
  • Always check expired() before dereferencing or locking.

The documentation for this class was generated from the following file:
  • WeakPtr.h