@@ -1645,45 +1645,42 @@ struct strong_weak_compact_ptr_storage : strong_weak_compact_ptr_storage_base,
16451645template <class T , class Alloc >
16461646class weak_compact_ptr ;
16471647template <class T , class Alloc >
1648- class strong_compact_ptr
1649- : public indirect_ptr<strong_weak_compact_ptr_storage<T, Alloc>> {
1648+ class strong_compact_ptr {
16501649 using Storage = strong_weak_compact_ptr_storage<T, Alloc>;
16511650 friend class weak_compact_ptr <T, Alloc>;
16521651
16531652public:
16541653 using weak_type = weak_compact_ptr<T, Alloc>;
16551654
1656- explicit strong_compact_ptr (Storage* ptr) noexcept
1657- : indirect_ptr<Storage>(ptr) {}
1655+ explicit strong_compact_ptr (Storage* ptr) noexcept : ptr_(ptr) {}
16581656 template <class ... Args>
16591657 strong_compact_ptr (const Alloc& alloc, Args&&... args)
1660- : indirect_ptr<Storage>(
1661- allocate<Storage>(alloc, alloc, std::forward<Args>(args)...)) {}
1662- strong_compact_ptr (const strong_compact_ptr& rhs) noexcept
1663- : indirect_ptr<Storage>(rhs.ptr_) {
1664- this ->ptr_ ->strong_count .fetch_add (1 , std::memory_order::relaxed);
1658+ : ptr_(allocate<Storage>(alloc, alloc, std::forward<Args>(args)...)) {}
1659+ strong_compact_ptr (const strong_compact_ptr& rhs) noexcept : ptr_(rhs.ptr_) {
1660+ ptr_->strong_count .fetch_add (1 , std::memory_order::relaxed);
16651661 }
16661662 strong_compact_ptr (strong_compact_ptr&& rhs) = delete ;
16671663 ~strong_compact_ptr () noexcept (std::is_nothrow_destructible_v<T>) {
1668- if (this ->ptr_ ->strong_count .fetch_sub (1 , std::memory_order::acq_rel) ==
1669- 1 ) {
1664+ if (ptr_->strong_count .fetch_sub (1 , std::memory_order::acq_rel) == 1 ) {
16701665 std::destroy_at (operator ->());
1671- if (this ->ptr_ ->weak_count .fetch_sub (1u , std::memory_order::release) ==
1672- 1 ) {
1673- deallocate (this ->ptr_ ->alloc , this ->ptr_ );
1666+ if (ptr_->weak_count .fetch_sub (1u , std::memory_order::release) == 1 ) {
1667+ deallocate (ptr_->alloc , ptr_);
16741668 }
16751669 }
16761670 }
16771671 T* operator ->() noexcept {
1678- return std::launder (reinterpret_cast <T*>(&this -> ptr_ ->value ));
1672+ return std::launder (reinterpret_cast <T*>(&ptr_->value ));
16791673 }
16801674 const T* operator ->() const noexcept {
1681- return std::launder (reinterpret_cast <const T*>(&this -> ptr_ ->value ));
1675+ return std::launder (reinterpret_cast <const T*>(&ptr_->value ));
16821676 }
16831677 T& operator *() & noexcept { return *operator ->(); }
16841678 const T& operator *() const & noexcept { return *operator ->(); }
16851679 T&& operator *() && noexcept { return std::move (*operator ->()); }
16861680 const T&& operator *() const && noexcept { return std::move (*operator ->()); }
1681+
1682+ private:
1683+ strong_weak_compact_ptr_storage<T, Alloc>* ptr_;
16871684};
16881685template <class T , class Alloc >
16891686class weak_compact_ptr {
0 commit comments