userver: utils::CheckedPtr< T > Class Template Reference
Loading...
Searching...
No Matches
utils::CheckedPtr< T > Class Template Reference

#include <userver/utils/checked_pointer.hpp>

Detailed Description

template<typename T>
class utils::CheckedPtr< T >

Utility template for returning a pointer to an object that is owned by someone else; throws std::runtime_error if nullptr is stored.

Useful for returning cache search result.

Definition at line 21 of file checked_pointer.hpp.

Public Member Functions

constexpr CheckedPtr (std::nullptr_t) noexcept
 
constexpr CheckedPtr (T *ptr) noexcept
 
constexpr operator bool () const noexcept
 
T * Get () const &
 
T * Get () &&
 
T * operator-> () const &
 
T * operator-> () &&
 
T & operator* () const &
 
T & operator* () &&
 

Constructor & Destructor Documentation

◆ CheckedPtr() [1/2]

template<typename T >
constexpr utils::CheckedPtr< T >::CheckedPtr ( std::nullptr_t )
inlineconstexprnoexcept

Definition at line 23 of file checked_pointer.hpp.

◆ CheckedPtr() [2/2]

template<typename T >
constexpr utils::CheckedPtr< T >::CheckedPtr ( T * ptr)
inlineexplicitconstexprnoexcept

Definition at line 25 of file checked_pointer.hpp.

Member Function Documentation

◆ Get() [1/2]

template<typename T >
T * utils::CheckedPtr< T >::Get ( ) &&
inline

Definition at line 39 of file checked_pointer.hpp.

◆ Get() [2/2]

template<typename T >
T * utils::CheckedPtr< T >::Get ( ) const &
inline

Definition at line 34 of file checked_pointer.hpp.

◆ operator bool()

template<typename T >
constexpr utils::CheckedPtr< T >::operator bool ( ) const
inlineexplicitconstexprnoexcept

Definition at line 27 of file checked_pointer.hpp.

◆ operator*() [1/2]

template<typename T >
T & utils::CheckedPtr< T >::operator* ( ) &&
inline

Definition at line 45 of file checked_pointer.hpp.

◆ operator*() [2/2]

template<typename T >
T & utils::CheckedPtr< T >::operator* ( ) const &
inline

Definition at line 44 of file checked_pointer.hpp.

◆ operator->() [1/2]

template<typename T >
T * utils::CheckedPtr< T >::operator-> ( ) &&
inline

Definition at line 42 of file checked_pointer.hpp.

◆ operator->() [2/2]

template<typename T >
T * utils::CheckedPtr< T >::operator-> ( ) const &
inline

Definition at line 41 of file checked_pointer.hpp.


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