Lagrange
value_ptr< T, Cloner, Deleter > Class Template Reference

Smart pointer with value semantics. More...

#include <lagrange/utils/value_ptr.h>

Public Types

using pointer = T *
 
using element_type = T
 
using cloner_type = Cloner
 
using deleter_type = Deleter
 

Public Member Functions

 value_ptr (const T &value)
 
 value_ptr (T &&value)
 
 value_ptr (const Cloner &value)
 
 value_ptr (Cloner &&value)
 
template<typename V , typename ClonerOrDeleter >
 value_ptr (V &&value, ClonerOrDeleter &&a2)
 
template<typename V , typename C , typename D >
 value_ptr (V &&value, C &&cloner, D &&deleter)
 
 value_ptr (value_ptr const &v)
 
 value_ptr (value_ptr &&v)=default
 
 value_ptr (pointer value)
 
pointer release ()
 
T * get () noexcept
 
T const * get () const noexcept
 
Cloner & get_cloner () noexcept
 
Cloner const & get_cloner () const noexcept
 
Deleter & get_deleter () noexcept
 
Deleter const & get_deleter () const noexcept
 
T & operator* ()
 
T const & operator* () const
 
T const * operator-> () const noexcept
 
T * operator-> () noexcept
 
value_ptr< T > & operator= (value_ptr &&v) noexcept
 
value_ptr< T > & operator= (value_ptr const &v)
 
 operator bool () const noexcept
 

Detailed Description

template<class T, class Cloner = default_clone<T>, class Deleter = std::default_delete<T>>
class lagrange::value_ptr< T, Cloner, Deleter >

Smart pointer with value semantics.

Copy/moving the pointer will copy/move the underlying object. This is useful to implement PIMPL idioms.

Template Parameters
TObject type of the pointee.
ClonerOptional cloner functor.
DeleterOptional deleter functor.

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