sparrow 0.3.0
Loading...
Searching...
No Matches
sparrow::value_ptr< T > Class Template Reference

A value_ptr is a smart pointer that behaves like a value. More...

#include <memory.hpp>

Public Types

using self_type = value_ptr<T>
 
using pointer = typename internal_pointer::pointer
 
using element_type = typename internal_pointer::element_type
 

Public Member Functions

constexpr value_ptr () noexcept=default
 
constexpr value_ptr (std::nullptr_t) noexcept
 
 value_ptr (T value)
 
 value_ptr (T *value)
 
 ~value_ptr ()=default
 
 value_ptr (const value_ptr &other)
 
 value_ptr (value_ptr &&other) noexcept=default
 
value_ptroperator= (const value_ptr &other)
 
value_ptroperator= (value_ptr &&other) noexcept=default
 
value_ptroperator= (std::nullptr_t) noexcept
 
void reset () noexcept
 
T * get () noexcept
 
const T * get () const noexcept
 
 operator bool () const noexcept
 
bool has_value () const noexcept
 
T & operator* ()
 
const T & operator* () const
 
T * operator-> ()
 
const T * operator-> () const
 

Detailed Description

template<class T>
class sparrow::value_ptr< T >

A value_ptr is a smart pointer that behaves like a value.

It manages the lifetime of an object of type T which is not stored in the value_ptr but a pointer, similar to unique_ptr. When copied, it copies the managed object.

Template Parameters
TThe type of the object managed by the value_ptr.

Definition at line 36 of file memory.hpp.

Member Typedef Documentation

◆ element_type

template<class T>
using sparrow::value_ptr< T >::element_type = typename internal_pointer::element_type

Definition at line 44 of file memory.hpp.

◆ pointer

template<class T>
using sparrow::value_ptr< T >::pointer = typename internal_pointer::pointer

Definition at line 43 of file memory.hpp.

◆ self_type

template<class T>
using sparrow::value_ptr< T >::self_type = value_ptr<T>

Definition at line 42 of file memory.hpp.

Constructor & Destructor Documentation

◆ value_ptr() [1/6]

template<class T>
sparrow::value_ptr< T >::value_ptr ( )
constexprdefaultnoexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ value_ptr() [2/6]

template<class T>
sparrow::value_ptr< T >::value_ptr ( std::nullptr_t )
constexprnoexcept

Definition at line 221 of file memory.hpp.

Here is the call graph for this function:

◆ value_ptr() [3/6]

template<class T>
sparrow::value_ptr< T >::value_ptr ( T value)
explicit

Definition at line 226 of file memory.hpp.

Here is the call graph for this function:

◆ value_ptr() [4/6]

template<class T>
sparrow::value_ptr< T >::value_ptr ( T * value)
explicit

Definition at line 232 of file memory.hpp.

◆ ~value_ptr()

template<class T>
sparrow::value_ptr< T >::~value_ptr ( )
default
Here is the call graph for this function:

◆ value_ptr() [5/6]

template<class T>
sparrow::value_ptr< T >::value_ptr ( const value_ptr< T > & other)

Definition at line 238 of file memory.hpp.

Here is the call graph for this function:

◆ value_ptr() [6/6]

template<class T>
sparrow::value_ptr< T >::value_ptr ( value_ptr< T > && other)
defaultnoexcept
Here is the call graph for this function:

Member Function Documentation

◆ get() [1/2]

template<class T>
const T * sparrow::value_ptr< T >::get ( ) const
nodiscardnoexcept

Definition at line 284 of file memory.hpp.

◆ get() [2/2]

template<class T>
T * sparrow::value_ptr< T >::get ( )
nodiscardnoexcept

Definition at line 278 of file memory.hpp.

Here is the caller graph for this function:

◆ has_value()

template<class T>
bool sparrow::value_ptr< T >::has_value ( ) const
nodiscardnoexcept

Definition at line 296 of file memory.hpp.

Here is the caller graph for this function:

◆ operator bool()

template<class T>
sparrow::value_ptr< T >::operator bool ( ) const
explicitnoexcept

Definition at line 290 of file memory.hpp.

Here is the call graph for this function:

◆ operator*() [1/2]

template<class T>
T & sparrow::value_ptr< T >::operator* ( )
nodiscard

Definition at line 302 of file memory.hpp.

◆ operator*() [2/2]

template<class T>
const T & sparrow::value_ptr< T >::operator* ( ) const
nodiscard

Definition at line 309 of file memory.hpp.

◆ operator->() [1/2]

template<class T>
T * sparrow::value_ptr< T >::operator-> ( )
nodiscard

Definition at line 316 of file memory.hpp.

◆ operator->() [2/2]

template<class T>
const T * sparrow::value_ptr< T >::operator-> ( ) const
nodiscard

Definition at line 323 of file memory.hpp.

◆ operator=() [1/3]

template<class T>
value_ptr< T > & sparrow::value_ptr< T >::operator= ( const value_ptr< T > & other)

Definition at line 244 of file memory.hpp.

Here is the call graph for this function:

◆ operator=() [2/3]

template<class T>
value_ptr< T > & sparrow::value_ptr< T >::operator= ( std::nullptr_t )
noexcept

Definition at line 265 of file memory.hpp.

Here is the call graph for this function:

◆ operator=() [3/3]

template<class T>
value_ptr & sparrow::value_ptr< T >::operator= ( value_ptr< T > && other)
defaultnoexcept
Here is the call graph for this function:

◆ reset()

template<class T>
void sparrow::value_ptr< T >::reset ( )
noexcept

Definition at line 272 of file memory.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

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