Spicy
Public Types | Public Member Functions | List of all members
hilti::optional_ref< T > Class Template Reference

#include <optional-ref.h>

Public Types

using nonConstT = typename std::remove_const< T >::type
 

Public Member Functions

 optional_ref (const optional_ref< T > &other)=default
 
 optional_ref (optional_ref< T > &&other) noexcept=default
 
 optional_ref (std::nullopt_t)
 
 optional_ref (T &other)
 
 optional_ref (T &&other)=delete
 
bool has_value () const
 
T & value () const
 
T & value_or (T &default_) const
 
void reset ()
 
T * operator-> () const
 
T & operator* () const
 
optional_refoperator= (const optional_ref< T > &other)=default
 
optional_refoperator= (optional_ref< T > &&other) noexcept=default
 
optional_refoperator= (std::nullopt_t)
 
optional_refoperator= (T &t)
 
optional_refoperator= (T &&t)=delete
 
 operator bool () const
 
bool operator== (const optional_ref< T > &other) const
 
bool operator!= (const optional_ref< T > &other) const
 
 operator std::optional< nonConstT > () const
 

Detailed Description

template<typename T>
class hilti::optional_ref< T >

Similar to std::optional<>T but storing a reference to the wrapped instance instead of a full copy. The caller must ensure that the underlying instance remains valid as long as necessary.


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