56 return opt_.value().get();
63 throw std::runtime_error(
"Optional reference has no value");
74 explicit operator bool()
const 76 return opt_.has_value();
100 std::optional<std::reference_wrapper<T>>
opt_;
optional_reference(std::nullopt_t)
optional_reference(T &ref)
std::optional< std::reference_wrapper< T > > opt_
optional_reference()=default
T * ptr() const
Returns a pointer to the referenced object or nullptr if no reference is held.
A simple wrapper class for optional reference types.
optional_reference< T > & operator=(T &new_ref)