15 if (a_ptr->DecRef() == 0) {
24 constexpr
static void Acquire([[maybe_unused]] T* a_ptr)
34 template <
class T,
template <
class>
class RefManager = BSTSmartPointerIntrusiveRefCount>
55 std::is_convertible_v<
76 std::is_convertible_v<
88 _ptr(std::move(a_rhs._ptr))
97 std::is_convertible_v<
102 _ptr(std::move(a_rhs._ptr))
104 a_rhs._ptr =
nullptr;
115 if (
this != std::addressof(a_rhs)) {
127 std::is_convertible_v<
142 if (
this != std::addressof(a_rhs)) {
144 _ptr = std::move(a_rhs._ptr);
145 a_rhs._ptr =
nullptr;
154 std::is_convertible_v<
161 _ptr = std::move(a_rhs._ptr);
162 a_rhs._ptr =
nullptr;
174 std::is_convertible_v<
192 [[nodiscard]]
explicit constexpr
operator bool() const noexcept
194 return static_cast<bool>(
_ptr);
199 assert(
static_cast<bool>(*
this));
205 assert(
static_cast<bool>(*
this));
210 template <
class,
template <
class>
class>
216 reference_manager::Acquire(
_ptr);
223 reference_manager::Release(
_ptr);
233 template <
class T,
class... Args>
239 template <
class T1,
class T2>
242 return a_lhs.
get() == a_rhs.
get();
245 template <
class T1,
class T2>
248 return !(a_lhs == a_rhs);
266 return static_cast<bool>(a_lhs);
272 return static_cast<bool>(a_rhs);
283 #define BSSmartPointer(className) \
285 using className##Ptr = RE::BSTSmartPointer<className>;
Definition: BSTSmartPointer.h:36
BSTSmartPointer(const BSTSmartPointer< Y > &a_rhs)
Definition: BSTSmartPointer.h:80
BSTSmartPointer(BSTSmartPointer &&a_rhs) noexcept
Definition: BSTSmartPointer.h:87
constexpr element_type & operator*() const noexcept
Definition: BSTSmartPointer.h:197
BSTSmartPointer & operator=(const BSTSmartPointer &a_rhs)
Definition: BSTSmartPointer.h:113
void reset()
Definition: BSTSmartPointer.h:166
void TryAttach()
Definition: BSTSmartPointer.h:213
void TryDetach()
Definition: BSTSmartPointer.h:220
constexpr BSTSmartPointer(std::nullptr_t) noexcept
Definition: BSTSmartPointer.h:47
element_type * _ptr
Definition: BSTSmartPointer.h:229
constexpr BSTSmartPointer() noexcept
Definition: BSTSmartPointer.h:42
BSTSmartPointer & operator=(BSTSmartPointer< Y > &&a_rhs)
Definition: BSTSmartPointer.h:158
constexpr element_type * operator->() const noexcept
Definition: BSTSmartPointer.h:203
BSTSmartPointer(const BSTSmartPointer &a_rhs)
Definition: BSTSmartPointer.h:66
~BSTSmartPointer()
Definition: BSTSmartPointer.h:107
RefManager< T > reference_manager
Definition: BSTSmartPointer.h:39
BSTSmartPointer(BSTSmartPointer< Y > &&a_rhs) noexcept
Definition: BSTSmartPointer.h:101
T element_type
Definition: BSTSmartPointer.h:38
BSTSmartPointer(Y *a_rhs)
Definition: BSTSmartPointer.h:59
BSTSmartPointer & operator=(const BSTSmartPointer< Y > &a_rhs)
Definition: BSTSmartPointer.h:131
BSTSmartPointer & operator=(BSTSmartPointer &&a_rhs)
Definition: BSTSmartPointer.h:140
constexpr element_type * get() const noexcept
Definition: BSTSmartPointer.h:187
void reset(Y *a_ptr)
Definition: BSTSmartPointer.h:178
Definition: AbsorbEffect.h:6
constexpr bool operator==(const BSTSmartPointer< T1 > &a_lhs, const BSTSmartPointer< T2 > &a_rhs)
Definition: BSTSmartPointer.h:240
BSTSmartPointer(T *) -> BSTSmartPointer< T, BSTSmartPointerIntrusiveRefCount >
BSTSmartPointer< T > make_smart(Args &&... a_args)
Definition: BSTSmartPointer.h:234
constexpr bool operator!=(const BSTSmartPointer< T1 > &a_lhs, const BSTSmartPointer< T2 > &a_rhs)
Definition: BSTSmartPointer.h:246
Definition: BSTSmartPointer.h:23
static void Release(T *a_ptr)
Definition: BSTSmartPointer.h:28
constexpr static void Acquire([[maybe_unused]] T *a_ptr)
Definition: BSTSmartPointer.h:24
Definition: BSTSmartPointer.h:7
static void Release(T *a_ptr)
Definition: BSTSmartPointer.h:13
static void Acquire(T *a_ptr)
Definition: BSTSmartPointer.h:8