From 0c0fe15bdd5fb7f137c6807ba43336f24f6df35b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 15 Jul 2024 08:56:21 +0200 Subject: w --- compat/borrowed-ptr.hpp | 50 ++++++++++++++++--------------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) (limited to 'compat/borrowed-ptr.hpp') diff --git a/compat/borrowed-ptr.hpp b/compat/borrowed-ptr.hpp index 6b1dcdf4..28d35b8f 100644 --- a/compat/borrowed-ptr.hpp +++ b/compat/borrowed-ptr.hpp @@ -1,7 +1,7 @@ #pragma once #include "borrowed-ptr-fwd.hpp" -namespace floormat::detail_borrowed_ptr { +namespace floormat::detail_bptr { struct control_block; @@ -12,11 +12,10 @@ concept StaticCastable = requires(From* from) { template concept DerivedFrom = requires(From* x) { - !std::is_same_v; std::is_convertible_v; }; -} // namespace floormat::detail_borrowed_ptr +} // namespace floormat::detail_bptr namespace floormat { @@ -33,47 +32,30 @@ struct bptr_base template class bptr final // NOLINT(*-special-member-functions) { - detail_borrowed_ptr::control_block* blk; - - template - requires std::is_convertible_v - bptr(const bptr& other, std::nullptr_t) noexcept; - - template - requires std::is_convertible_v - bptr(bptr&& other, std::nullptr_t) noexcept; + detail_bptr::control_block* blk; + template bptr(const bptr& other, std::nullptr_t) noexcept; + template bptr(bptr&& other, std::nullptr_t) noexcept; template bptr& _copy_assign(const bptr& other) noexcept; template bptr& _move_assign(bptr&& other) noexcept; public: template - requires (std::is_constructible_v, Ts&&...> && std::is_convertible_v) + requires std::is_constructible_v, Ts&&...> explicit bptr(InPlaceInitT, Ts&&... args) noexcept; - explicit bptr(T* ptr) noexcept requires std::is_convertible_v; - bptr() noexcept requires std::is_convertible_v; + explicit bptr(T* ptr) noexcept requires std::is_convertible_v; + bptr() noexcept; ~bptr() noexcept; - bptr(std::nullptr_t) noexcept requires std::is_convertible_v; // NOLINT(*-explicit-conversions) - bptr& operator=(std::nullptr_t) noexcept requires std::is_convertible_v; - - bptr(const bptr&) noexcept requires std::is_convertible_v; - bptr& operator=(const bptr&) noexcept requires std::is_convertible_v; - - template Y> bptr(const bptr&) noexcept - requires std::is_convertible_v; - - template Y> bptr& operator=(const bptr&) noexcept - requires std::is_convertible_v; + bptr(std::nullptr_t) noexcept; // NOLINT(*-explicit-conversions) + bptr& operator=(std::nullptr_t) noexcept; - bptr(bptr&&) noexcept requires std::is_convertible_v; - bptr& operator=(bptr&&) noexcept requires std::is_convertible_v; + template Y> bptr(const bptr&) noexcept; + template Y> bptr& operator=(const bptr&) noexcept; - template Y> bptr(bptr&&) noexcept - requires std::is_convertible_v; - template Y> bptr& operator=(bptr&&) noexcept - requires std::is_convertible_v; + template Y> bptr(bptr&&) noexcept; + template Y> bptr& operator=(bptr&&) noexcept; void reset() noexcept; void destroy() noexcept; @@ -91,12 +73,12 @@ public: template friend class bptr; template - requires (std::is_convertible_v && detail_borrowed_ptr::StaticCastable) + requires detail_bptr::StaticCastable friend bptr static_pointer_cast(const bptr& p) noexcept; }; template -requires (std::is_convertible_v && detail_borrowed_ptr::StaticCastable) +requires detail_bptr::StaticCastable bptr static_pointer_cast(const bptr& p) noexcept { if (p.blk && p.blk->_ptr) [[likely]] -- cgit v1.2.3