|
constexpr | optref () noexcept |
| Default constructor - std::optional contains no reference.
|
|
constexpr | optref (std::nullopt_t) noexcept |
| Nullopt constructor - no reference.
|
|
constexpr | optref (const optref &other) noexcept |
| Copy constructor.
|
|
template<typename U >
requires std::convertible_to<U, T> |
constexpr | optref (const optref< U > &other) noexcept |
| Converting copy constructor for base/derived class references.
|
|
constexpr | optref (T &reference) noexcept |
| Construct an optref from reference.
|
|
constexpr | optref (std::reference_wrapper< T > wrapper) noexcept |
| Construct an optref from std::reference_wrapper.
|
|
constexpr | optref (T *pointer) noexcept |
| Construct an optref from a pointer.
|
|
constexpr bool | has_reference () const noexcept |
| Does it contain a reference?
|
|
constexpr | operator bool () const noexcept |
| Does it contain a reference?
|
|
constexpr reference_type | reference () |
| Get the contained reference; throws if none.
|
|
constexpr const_reference_type | reference () const |
| Get the contained const reference; throws if none.
|
|
void | swap (optref &other) noexcept |
| Swap implementation.
|
|
void | reset () noexcept |
| Reset (cannot assign after).
|
|
template<typename T>
requires not_reference<T>
struct liber::optref< T >
A std::optional<std::reference_wrapper<T>> wrapper for lvalue references.
Satisfies CopyConstructible, CopyAssignable and TriviallyCopyable.
- Template Parameters
-
T | the (optionally) referenced object |