Basic eventually¶
-
template<returnable T, bool Exception>
class basic_eventually : private lf::impl::immovable<basic_eventually<T, Exception>>¶ A wrapper to delay construction of an object.
An eventually is either empty, contains an object of type
T
or, (ifException
is true) contains an exception. Assignment to an empty eventually will construct an object of typeT
inside the eventually.Public Functions
-
inline basic_eventually() noexcept¶
Construct an empty eventually.
-
inline basic_eventually() noexcept
Construct an empty eventually.
-
inline basic_eventually() noexcept
Construct an empty eventually.
-
inline ~basic_eventually() noexcept¶
Destroy the eventually object and the contained object.
-
inline auto empty() const noexcept -> bool¶
Check if the eventually is empty.
-
inline auto exception() && noexcept -> std::exception_ptr&&¶
Access the stored exception,
has_exception()
must be true.
-
inline auto exception() & noexcept -> std::exception_ptr&¶
Access the stored exception,
has_exception()
must be true.
-
inline auto exception() const && noexcept -> std::exception_ptr const&&¶
Access the stored exception,
has_exception()
must be true.
-
inline auto exception() const & noexcept -> std::exception_ptr const&¶
Access the stored exception,
has_exception()
must be true.
-
inline auto has_exception() const noexcept -> bool¶
Test is there is an exception stored in the eventually.
-
inline auto has_value() const noexcept -> bool¶
Check if there is a value stored in the eventually.
-
inline auto operator*() && noexcept -> std::add_rvalue_reference_t<T>¶
Access the stored value,
has_value()
must be true.
-
inline auto operator*() & noexcept -> std::add_lvalue_reference_t<T>¶
Access the stored value,
has_value()
must be true.
-
inline auto operator*() const && noexcept -> std::add_rvalue_reference_t<T const>¶
Access the stored value,
has_value()
must be true.
-
inline auto operator*() const && noexcept -> T
Access the stored value,
has_value()
must be true.This will not decay T&& to T&, nor will it promote T& to T&&.
-
inline auto operator*() const & noexcept -> std::add_lvalue_reference_t<std::remove_reference_t<T>>¶
Access the stored value,
has_value()
must be true.This will decay
T&&
toT&
just like using aT &&
reference would.
-
inline auto operator*() const & noexcept -> std::add_lvalue_reference_t<T const>
Access the stored value,
has_value()
must be true.
-
inline auto operator->() const noexcept -> std::add_pointer_t<T>¶
Access the stored value,
has_value()
must be true.
-
inline auto operator->() const noexcept -> std::add_pointer_t<T const>
Access the stored value,
has_value()
must be true.
-
inline auto operator->() noexcept -> std::add_pointer_t<T>¶
Access the stored value,
has_value()
must be true.
-
template<impl::safe_ref_bind_to<T> U>
inline auto operator=(U &&expr) noexcept -> basic_eventually&¶ Store a value in the eventually, requires that
empty()
is true.After this function is called,
has_value()
will be true.
-
template<typename U>
inline auto operator=(U &&expr) noexcept(std::is_nothrow_constructible_v<T, U>) -> basic_eventually&¶ Store a value in the eventually, requires that
empty()
is true.After this function is called,
has_value()
will be true.
-
inline basic_eventually() noexcept¶