Loading...
Searching...
No Matches
Public Member Functions | Private Types | Static Private Attributes | List of all members
pointer< T > Class Template Reference

Pointer wrapper that takes handle both shared as well as regular (unmanaged) pointers. More...

#include <pointer.h>

Inherits shared_ptr< std::remove_reference_t< T > >.

Public Member Functions

constexpr pointer (ptr_t ptr=nullptr, bool managed=false) noexcept
 Init from a regular pointer.
 
constexpr bool is_managed (void) const
 Returns true if the pointer manages the object deallocation.
 
Init from a shared_ptr
template<typename Y >
constexpr pointer (const std::shared_ptr< Y > &ptr) noexcept
 
template<typename Y >
constexpr pointer (std::shared_ptr< Y > &&ptr) noexcept
 

Private Types

using ptr_t = std::add_pointer_t< std::remove_all_extents_t< T > >
 
using base_type = std::shared_ptr< std::remove_reference_t< T > >
 

Static Private Attributes

static constexpr auto empty_delete = [](ptr_t){}
 

Detailed Description

template<typename T>
class bbm::pointer< T >

Pointer wrapper that takes handle both shared as well as regular (unmanaged) pointers.

This is a wrapper around shared_ptr that replaced the deleter with an empty deleter if the object should not be managed by the pointer.

Member Typedef Documentation

◆ base_type

using base_type = std::shared_ptr<std::remove_reference_t<T> >
private

◆ ptr_t

using ptr_t = std::add_pointer_t<std::remove_all_extents_t<T> >
private

Constructor & Destructor Documentation

◆ pointer() [1/3]

constexpr pointer ( ptr_t  ptr = nullptr,
bool  managed = false 
)
inlineconstexprnoexcept

Init from a regular pointer.

◆ pointer() [2/3]

constexpr pointer ( const std::shared_ptr< Y > &  ptr)
inlineconstexprnoexcept

◆ pointer() [3/3]

constexpr pointer ( std::shared_ptr< Y > &&  ptr)
inlineconstexprnoexcept

Member Function Documentation

◆ is_managed()

constexpr bool is_managed ( void  ) const
inlineconstexpr

Returns true if the pointer manages the object deallocation.

Member Data Documentation

◆ empty_delete

constexpr auto empty_delete = [](ptr_t){}
staticconstexprprivate

The documentation for this class was generated from the following file: