LocalGuidance
A library that generates velocity references to follow a path.
std_utils::observer_ptr< T > Class Template Reference

An object which wraps around a pointer without taking ownership. More...

#include <ObserverPointer.hpp>

Public Types

using element_type = T
 

Public Member Functions

 observer_ptr ()
 
 ~observer_ptr ()=default
 
template<typename custom_deleter , typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
 observer_ptr (const std::unique_ptr< OtherT_, custom_deleter > &other)
 Copy construct from unique pointer. More...
 
template<typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
 observer_ptr (const std::shared_ptr< OtherT_ > &other)
 Copy construct from a shared pointer. More...
 
template<typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
 observer_ptr (const std_utils::observer_ptr< OtherT_ > &other)
 Copy construct from an observer pointer. More...
 
template<typename custom_deleter , typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
observer_ptroperator= (const std::unique_ptr< OtherT_, custom_deleter > &other)
 Copy assign from unique pointers. More...
 
template<typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
observer_ptroperator= (const std::shared_ptr< OtherT_ > &other)
 Copy assign from a shared pointer. More...
 
template<typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
observer_ptroperator= (const std_utils::observer_ptr< OtherT_ > &other)
 Copy assign from an observer pointer. More...
 
 observer_ptr (std::shared_ptr< element_type > &&other)=delete
 Delete move construction from shared pointers. More...
 
observer_ptroperator= (std::shared_ptr< element_type > &&other)=delete
 Delete move assign from shared pointers. More...
 
template<typename custom_deleter >
 observer_ptr (std::unique_ptr< element_type, custom_deleter > &&other)=delete
 Delete move construction from unique pointers. More...
 
template<typename custom_deleter >
observer_ptroperator= (std::unique_ptr< element_type, custom_deleter > &&other)=delete
 Delete move assign from unique pointers. More...
 
T *const get () const noexcept
 
T *const operator-> () const noexcept
 
T & operator* () const
 

Private Attributes

T * ptr_
 

Detailed Description

template<typename T>
class std_utils::observer_ptr< T >

An object which wraps around a pointer without taking ownership.

Template Parameters
TThe (decayed) type of the object which is wrapped around.

Member Typedef Documentation

template<typename T >
using std_utils::observer_ptr< T >::element_type = T

Constructor & Destructor Documentation

template<typename T >
std_utils::observer_ptr< T >::observer_ptr ( )
inline
template<typename T >
std_utils::observer_ptr< T >::~observer_ptr ( )
default
template<typename T >
template<typename custom_deleter , typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
std_utils::observer_ptr< T >::observer_ptr ( const std::unique_ptr< OtherT_, custom_deleter > &  other)
inlineexplicit

Copy construct from unique pointer.

template<typename T >
template<typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
std_utils::observer_ptr< T >::observer_ptr ( const std::shared_ptr< OtherT_ > &  other)
inlineexplicit

Copy construct from a shared pointer.

template<typename T >
template<typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
std_utils::observer_ptr< T >::observer_ptr ( const std_utils::observer_ptr< OtherT_ > &  other)
inlineexplicit

Copy construct from an observer pointer.

template<typename T >
std_utils::observer_ptr< T >::observer_ptr ( std::shared_ptr< element_type > &&  other)
delete

Delete move construction from shared pointers.

template<typename T >
template<typename custom_deleter >
std_utils::observer_ptr< T >::observer_ptr ( std::unique_ptr< element_type, custom_deleter > &&  other)
delete

Delete move construction from unique pointers.

Member Function Documentation

template<typename T >
T* const std_utils::observer_ptr< T >::get ( ) const
inlinenoexcept
template<typename T >
T& std_utils::observer_ptr< T >::operator* ( ) const
inline
template<typename T >
T* const std_utils::observer_ptr< T >::operator-> ( ) const
inlinenoexcept
template<typename T >
template<typename custom_deleter , typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
observer_ptr& std_utils::observer_ptr< T >::operator= ( const std::unique_ptr< OtherT_, custom_deleter > &  other)
inline

Copy assign from unique pointers.

template<typename T >
template<typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
observer_ptr& std_utils::observer_ptr< T >::operator= ( const std::shared_ptr< OtherT_ > &  other)
inline

Copy assign from a shared pointer.

template<typename T >
template<typename OtherT_ , typename = typename std::enable_if<std::is_base_of<element_type, OtherT_>::value>::type>
observer_ptr& std_utils::observer_ptr< T >::operator= ( const std_utils::observer_ptr< OtherT_ > &  other)
inline

Copy assign from an observer pointer.

template<typename T >
observer_ptr& std_utils::observer_ptr< T >::operator= ( std::shared_ptr< element_type > &&  other)
delete

Delete move assign from shared pointers.

template<typename T >
template<typename custom_deleter >
observer_ptr& std_utils::observer_ptr< T >::operator= ( std::unique_ptr< element_type, custom_deleter > &&  other)
delete

Delete move assign from unique pointers.

Member Data Documentation

template<typename T >
T* std_utils::observer_ptr< T >::ptr_
private

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