diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-07-16 15:43:10 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-07-16 15:43:10 +0200 |
commit | fa2b1ab5fbfb5ce6d9380278dabe2ebab2ab8179 (patch) | |
tree | 2b8d9174b4b00d7cfe28efe9817dafd84622908a | |
parent | 8f62c3329948f3bd1aa5dc208ab5efac42543a57 (diff) |
wa
-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); } |