diff options
-rw-r--r-- | compat/borrowed-ptr.hpp | 4 | ||||
-rw-r--r-- | compat/borrowed-ptr.inl | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/compat/borrowed-ptr.hpp b/compat/borrowed-ptr.hpp index c4cc7975..741b3e53 100644 --- a/compat/borrowed-ptr.hpp +++ b/compat/borrowed-ptr.hpp @@ -62,7 +62,7 @@ class bptr final // NOLINT(*-special-member-functions) public: template<typename... Ts> - requires std::is_constructible_v<std::remove_const_t<T>, Ts&&...> + //requires std::is_constructible_v<std::remove_const_t<T>, Ts&&...> explicit bptr(InPlaceInitT, Ts&&... args) noexcept; template<detail_bptr::DerivedFrom<T> Y> explicit bptr(Y* ptr) noexcept; @@ -102,6 +102,8 @@ public: bool operator==(const std::nullptr_t& other) const noexcept; std::strong_ordering operator<=>(const bptr<const T>& other) const noexcept; + std::strong_ordering operator<=>(const bptr<T>& other) const noexcept requires (!std::is_const_v<T>); + std::strong_ordering operator<=>(const std::nullptr_t&) const noexcept; template<typename U> friend class bptr; template<typename U> friend class weak_bptr; diff --git a/compat/borrowed-ptr.inl b/compat/borrowed-ptr.inl index dfc112c7..b31326e7 100644 --- a/compat/borrowed-ptr.inl +++ b/compat/borrowed-ptr.inl @@ -11,7 +11,7 @@ namespace floormat { template<typename T> template<typename... Ts> -requires std::is_constructible_v<std::remove_const_t<T>, Ts&&...> +//requires std::is_constructible_v<std::remove_const_t<T>, Ts&&...> bptr<T>::bptr(InPlaceInitT, Ts&&... args) noexcept: bptr{ new std::remove_const_t<T>{ forward<Ts>(args)... } } {} @@ -160,9 +160,13 @@ template<typename T> bool bptr<T>::operator==(const std::nullptr_t&) const noexc template<typename T> std::strong_ordering bptr<T>::operator<=>(const bptr<const T>& other) const noexcept -{ - return get() <=> other.get(); -} +{ return get() <=> other.get(); } + +template<typename T> std::strong_ordering bptr<T>::operator<=>(const bptr<T>& other) const noexcept requires (!std::is_const_v<T>) +{ return get() <=> other.get(); } + +template<typename T> std::strong_ordering bptr<T>::operator<=>(const std::nullptr_t&) const noexcept +{ return get() <=> (T*)nullptr; } template<typename T> void bptr<T>::swap(bptr& other) noexcept { floormat::swap(blk, other.blk); } |