#pragma once namespace floormat::detail_borrowed_ptr { struct control_block_; } namespace floormat { template class bptr; template bool operator==(const bptr& a, const bptr& b) noexcept; template class bptr final // NOLINT(*-special-member-functions) { mutable T* casted_ptr; detail_borrowed_ptr::control_block_* blk; explicit bptr(DirectInitT, T* casted_ptr, detail_borrowed_ptr::control_block_* blk) noexcept; //explicit bptr(NoInitT) noexcept; public: template requires std::is_constructible_v explicit bptr(InPlaceInitT, Ts&&... args) noexcept; bptr(std::nullptr_t) noexcept; // NOLINT(*-explicit-conversions) bptr() noexcept; explicit bptr(T* ptr) noexcept; ~bptr() noexcept; bptr& operator=(std::nullptr_t) noexcept; template requires std::is_convertible_v bptr(const bptr&) noexcept; template requires std::is_convertible_v bptr& operator=(const bptr&) noexcept; template requires std::is_convertible_v bptr(bptr&&) noexcept; template requires std::is_convertible_v bptr& operator=(bptr&&) noexcept; friend bool operator==(const bptr& a, const bptr& b) noexcept; explicit operator bool() const noexcept; void reset() noexcept; template void destroy() noexcept; void swap(bptr& other) noexcept; uint32_t use_count() const noexcept; T* get() const noexcept; T* operator->() const noexcept; T& operator*() const noexcept; template friend class bptr; template friend bptr static_pointer_cast(const bptr& p) noexcept; }; } // namespace floormat