49 if (m_ptr !=
nullptr) {
50 IntrusiveSharedPtrIncRefCount(m_ptr);
55 if (m_ptr !=
nullptr) {
56 IntrusiveSharedPtrDecRefCount(m_ptr);
65 if (m_ptr !=
nullptr) {
66 IntrusiveSharedPtrIncRefCount(m_ptr);
74 requires(!std::same_as<T, U> && std::convertible_to<U*, T*>)
78 if (m_ptr !=
nullptr) {
79 IntrusiveSharedPtrIncRefCount(m_ptr);
88 if (m_ptr ==
rhs.m_ptr) {
92 if (m_ptr !=
nullptr) {
93 IntrusiveSharedPtrDecRefCount(m_ptr);
98 if (m_ptr !=
nullptr) {
99 IntrusiveSharedPtrIncRefCount(m_ptr);
108 template <
typename U>
109 requires(!std::same_as<T, U> && std::convertible_to<U*, T*>)
112 if (m_ptr ==
rhs.m_ptr) {
116 if (m_ptr !=
nullptr) {
117 IntrusiveSharedPtrDecRefCount(m_ptr);
122 if (m_ptr !=
nullptr) {
123 IntrusiveSharedPtrIncRefCount(m_ptr);
133 : m_ptr{std::exchange(
rhs.m_ptr,
nullptr)} {}
138 template <
typename U>
139 requires(!std::same_as<T, U> && std::convertible_to<U*, T*>)
142 : m_ptr{std::exchange(
rhs.m_ptr,
nullptr)} {}
149 if (m_ptr ==
rhs.m_ptr) {
153 std::swap(m_ptr,
rhs.m_ptr);
161 template <
typename U>
162 requires(!std::same_as<T, U> && std::convertible_to<U*, T*>)
165 if (m_ptr ==
rhs.m_ptr) {
169 std::swap(m_ptr,
rhs.m_ptr);
200 return lhs.m_ptr ==
rhs.m_ptr;
209 return lhs.m_ptr !=
rhs.m_ptr;
216 std::nullptr_t)
noexcept {
217 return lhs.m_ptr ==
nullptr;
225 return nullptr ==
rhs.m_ptr;
233 std::nullptr_t)
noexcept {
234 return lhs.m_ptr !=
nullptr;
243 return nullptr !=
rhs.m_ptr;
258template <
typename T,
typename...
Args>
274template <
typename T,
typename Alloc,
typename...
Args>
276 auto ptr = std::allocator_traits<Alloc>::allocate(
alloc,
sizeof(T));
277 std::allocator_traits<Alloc>::construct(
alloc, ptr,
278 std::forward<Args>(args)...);
Definition IntrusiveSharedPtr.hpp:29
constexpr IntrusiveSharedPtr(IntrusiveSharedPtr< U > &&rhs) noexcept
Definition IntrusiveSharedPtr.hpp:140
friend constexpr bool operator==(std::nullptr_t, const IntrusiveSharedPtr< T > &rhs) noexcept
Definition IntrusiveSharedPtr.hpp:223
constexpr IntrusiveSharedPtr< T > & operator=(IntrusiveSharedPtr< T > &&rhs) noexcept
Definition IntrusiveSharedPtr.hpp:147
constexpr T * Get() const noexcept
Definition IntrusiveSharedPtr.hpp:177
friend constexpr bool operator!=(const IntrusiveSharedPtr< T > &lhs, std::nullptr_t) noexcept
Definition IntrusiveSharedPtr.hpp:232
constexpr IntrusiveSharedPtr< T > & operator=(const IntrusiveSharedPtr< T > &rhs) noexcept
Definition IntrusiveSharedPtr.hpp:86
friend constexpr bool operator==(const IntrusiveSharedPtr< T > &lhs, std::nullptr_t) noexcept
Definition IntrusiveSharedPtr.hpp:215
constexpr ~IntrusiveSharedPtr()
Definition IntrusiveSharedPtr.hpp:54
friend constexpr bool operator==(const IntrusiveSharedPtr< T > &lhs, const IntrusiveSharedPtr< T > &rhs) noexcept
Definition IntrusiveSharedPtr.hpp:198
constexpr IntrusiveSharedPtr(const IntrusiveSharedPtr< U > &rhs) noexcept
Definition IntrusiveSharedPtr.hpp:75
constexpr IntrusiveSharedPtr(T *ptr) noexcept
Definition IntrusiveSharedPtr.hpp:48
constexpr T & operator*() const noexcept
Definition IntrusiveSharedPtr.hpp:182
constexpr IntrusiveSharedPtr() noexcept=default
friend constexpr bool operator!=(std::nullptr_t, const IntrusiveSharedPtr< T > &rhs) noexcept
Definition IntrusiveSharedPtr.hpp:241
constexpr IntrusiveSharedPtr(const IntrusiveSharedPtr< T > &rhs) noexcept
Definition IntrusiveSharedPtr.hpp:63
constexpr T * operator->() const noexcept
Definition IntrusiveSharedPtr.hpp:187
constexpr IntrusiveSharedPtr(IntrusiveSharedPtr< T > &&rhs) noexcept
Definition IntrusiveSharedPtr.hpp:132
friend constexpr bool operator!=(const IntrusiveSharedPtr< T > &lhs, const IntrusiveSharedPtr< T > &rhs) noexcept
Definition IntrusiveSharedPtr.hpp:207
Definition Expression.hpp:18
IntrusiveSharedPtr< T > AllocateIntrusiveShared(Alloc alloc, Args &&... args)
Definition IntrusiveSharedPtr.hpp:275
IntrusiveSharedPtr< T > MakeIntrusiveShared(Args &&... args)
Definition IntrusiveSharedPtr.hpp:259