sparrow 0.9.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
 
constexpr value_ptr (T value)
 
constexpr value_ptr (T *value)
 
 ~value_ptr ()=default
 
constexpr value_ptr (const value_ptr &other)
 
constexpr value_ptr (value_ptr &&other) noexcept=default
 
constexpr value_ptroperator= (const value_ptr &other)
 
constexpr value_ptroperator= (value_ptr &&other) noexcept=default
 
constexpr value_ptroperator= (std::nullptr_t) noexcept
 
constexpr void reset () noexcept
 
constexpr T * get () noexcept
 
constexpr const T * get () const noexcept
 
constexpr operator bool () const noexcept
 
constexpr bool has_value () const noexcept
 
constexpr T & operator* ()
 
constexpr const T & operator* () const
 
constexpr T * operator-> ()
 
constexpr 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 35 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 43 of file memory.hpp.

◆ pointer

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

Definition at line 42 of file memory.hpp.

◆ self_type

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

Definition at line 41 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 220 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)
explicitconstexpr

Definition at line 225 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)
explicitconstexpr

Definition at line 231 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)
constexpr

Definition at line 237 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)
constexprdefaultnoexcept
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
nodiscardconstexprnoexcept

Definition at line 283 of file memory.hpp.

◆ get() [2/2]

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

Definition at line 277 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
nodiscardconstexprnoexcept

Definition at line 295 of file memory.hpp.

Here is the caller graph for this function:

◆ operator bool()

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

Definition at line 289 of file memory.hpp.

Here is the call graph for this function:

◆ operator*() [1/2]

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

Definition at line 301 of file memory.hpp.

◆ operator*() [2/2]

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

Definition at line 308 of file memory.hpp.

◆ operator->() [1/2]

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

Definition at line 315 of file memory.hpp.

◆ operator->() [2/2]

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

Definition at line 322 of file memory.hpp.

◆ operator=() [1/3]

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

Definition at line 243 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 )
constexprnoexcept

Definition at line 264 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)
constexprdefaultnoexcept
Here is the call graph for this function:

◆ reset()

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

Definition at line 271 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: