diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-04 14:37:06 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-05 03:31:19 +0200 |
commit | c1ad7d0ead5132520956c8d6ee6a9c6887d38556 (patch) | |
tree | 1272a4555a544b06da5e315336ad102c53667dd7 /compat/borrowed-ptr.inl | |
parent | bbe2474e248dceffe89fe7f23ad7abce5452fc97 (diff) |
a w
Diffstat (limited to 'compat/borrowed-ptr.inl')
-rw-r--r-- | compat/borrowed-ptr.inl | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/compat/borrowed-ptr.inl b/compat/borrowed-ptr.inl index 7cb373ca..2faca999 100644 --- a/compat/borrowed-ptr.inl +++ b/compat/borrowed-ptr.inl @@ -69,6 +69,14 @@ bptr{ new T{ forward<Ts...>(args...) } } { } +template<typename T> constexpr bptr<T>::bptr(NoInitT) noexcept {}; + +template<typename T> +constexpr bptr<T>::bptr(DirectInitT, T* ptr, detail_borrowed_ptr::control_block_* blk) noexcept: + ptr{ptr}, blk{blk} +{ +} + template<typename T> bptr<T>::bptr(T* ptr) noexcept: ptr{ptr}, @@ -139,17 +147,4 @@ bptr<T>& bptr<T>::operator=(bptr<Y>&& other) noexcept return *this; } -template<typename T> -template<typename U> -requires detail_borrowed_ptr::StaticCastable<T, U> -bptr<U> bptr<T>::static_pointer_cast() noexcept -{ - auto ret = bptr<T>{NoInit}; - ret.blk = blk; - if (ret.blk) [[likely]] - ret.blk->incr(); - ret.ptr = static_cast<T*>(ptr); - return ret; -} - } // namespace floormat |