Inherits AZStd::Internal::expected_storage_move_assignment< T, E, special_member_availability >.
|
template<bool Enable = is_void_v<T> || is_default_constructible_v<T>, class = enable_if_t<Enable>> |
constexpr | expected () noexcept |
|
constexpr | expected (const expected &rhs)=default |
| copy constructor - Defaults to the expected_storage_copy_constructor for constraint checks
|
|
constexpr | expected (expected &&rhs)=default |
| move constructor - Defaults to the expected_storage_move_constructor for constraint checks
|
|
template<class U , class G , class = enable_if_t< ((is_void_v<T> && is_void_v<U>) || is_constructible_v<T, add_lvalue_reference_t<const U>>) && is_constructible_v<E, const G&> && Internal::not_convertible_or_constructible_from_other_std_expected_v<T, E, U, G>>> |
constexpr | expected (const expected< U, G > &rhs) |
| expected<U, G> copy conversion constructor
|
|
template<class U , class G , class = enable_if_t< ((is_void_v<T> && is_void_v<U>) || is_constructible_v<T, U>) && is_constructible_v<E, G> && Internal::not_convertible_or_constructible_from_other_std_expected_v<T, E, U, G>>> |
constexpr | expected (expected< U, G > &&rhs) |
| expected<U, G> move conversion constructor
|
|
template<class U = T, class = enable_if_t<!is_void_v<T> && !is_same_v<remove_cvref_t<U>, in_place_t> && !is_same_v<expected, remove_cvref_t<U>> && !Internal::is_std_unexpected_specialization_v<remove_cvref_t<U>> && is_constructible_v<T, U> >> |
constexpr | expected (U &&v) |
| value direct initialization constructor
|
|
template<class G , class = enable_if_t<is_constructible_v<E, const G&> >> |
constexpr | expected (const unexpected< G > &err) |
| error unexpected<G> copy constructor
|
|
template<class G , class = enable_if_t<is_constructible_v<E, G> >> |
constexpr | expected (unexpected< G > &&err) |
| error unexpected<G> move constructor
|
|
template<class... Args, class = enable_if_t<!is_void_v<T>&& is_constructible_v<T, Args...>, int>> |
constexpr | expected (in_place_t, Args &&... args) |
| Direct non-list initialization for expected type with variadic arguments.
|
|
template<class U , class... Args, class = enable_if_t<!is_void_v<T>&& is_constructible_v<T, initializer_list<U>&, Args...>, int>> |
constexpr | expected (in_place_t, initializer_list< U > il, Args &&...args) |
|
template<bool Enable = is_void_v<T>, class = enable_if_t<Enable>> |
constexpr | expected (in_place_t) |
| expected<void, E> specialization for in-place constructor
|
|
template<class... Args, class = enable_if_t<is_constructible_v<E, Args...>, int>> |
constexpr | expected (unexpect_t, Args &&... args) |
| Direct non-list initialization for error type with variadic arguments.
|
|
template<class U , class... Args, class = enable_if_t<is_constructible_v<E, initializer_list<U>&, Args...>, int>> |
constexpr | expected (unexpect_t, initializer_list< U > il, Args &&...args) |
|
| ~expected ()=default |
| destructor - Defaults to the expected_union for constraint checks
|
|
constexpr expected & | operator= (const expected &rhs)=default |
| Copy-assignment from other expected.
|
|
constexpr expected & | operator= (expected &&rhs) noexcept(is_nothrow_move_assignable_v< T > &&is_nothrow_move_constructible_v< T > &&is_nothrow_move_assignable_v< E > &&is_nothrow_move_constructible_v< E >)=default |
| Move-assignment from other expected.
|
|
template<class U = T, class = enable_if_t<!is_void_v<T> && !is_same_v<expected, remove_cvref_t<U>> && !Internal::is_std_unexpected_specialization_v<remove_cvref_t<U>> && is_constructible_v<T, U> && is_assignable_v<add_lvalue_reference_t<T>, U>>> |
constexpr auto | operator= (U &&value) -> expected & |
| Direct initializes value into expected.
|
|
template<class G > |
constexpr auto | operator= (const unexpected< G > &error) -> enable_if_t< is_constructible_v< E, const G & > &&is_assignable_v< E &, const G & >, expected & > |
| Copy error into expected.
|
|
template<class G > |
constexpr auto | operator= (unexpected< G > &&error) -> enable_if_t< is_constructible_v< E, G > &&is_assignable_v< E &, G >, expected & > |
| Move error into expected.
|
|
template<class... Args> |
constexpr decltype(auto) | emplace (Args &&...) noexcept |
| emplace overloads for when T is not a void type
|
|
template<class U , class... Args> |
constexpr decltype(auto) | emplace (initializer_list< U >, Args &&...) noexcept |
|
template<bool Enable = is_void_v<T>, class = enable_if_t<Enable>> |
constexpr void | emplace () noexcept |
| emplace overload for when T is void
|
|
template<bool Enable = !is_void_v<T> && is_swappable_v<T> && is_swappable_v<E> && is_move_constructible_v<T> && is_move_constructible_v<E>> |
constexpr auto | swap (expected &rhs) noexcept(is_nothrow_move_constructible_v< T > &&is_nothrow_swappable_v< T > &&is_nothrow_move_constructible_v< E > &&is_nothrow_swappable_v< E >) -> enable_if_t< Enable > |
| expected swap
|
|
constexpr | operator bool () const noexcept |
| Returns whether the expected contains a value type(true) or error type(false)
|
|
constexpr bool | has_value () const noexcept |
|
template<bool Enable = !is_void_v<T>> |
constexpr auto | operator-> () const noexcept -> enable_if_t< Enable, const T * > |
|
template<bool Enable = !is_void_v<T>> |
constexpr auto | operator-> () noexcept -> enable_if_t< Enable, T * > |
|
template<bool Enable = !is_void_v<T>> |
constexpr auto | operator* () const &noexcept -> enable_if_t< Enable, add_lvalue_reference_t< const T > > |
|
template<bool Enable = !is_void_v<T>> |
constexpr auto | operator* () &noexcept -> enable_if_t< Enable, add_lvalue_reference_t< T > > |
|
template<bool Enable = !is_void_v<T>> |
constexpr auto | operator* () const &&noexcept -> enable_if_t< Enable, add_rvalue_reference_t< const T > > |
|
template<bool Enable = !is_void_v<T>> |
constexpr auto | operator* () &&noexcept -> enable_if_t< Enable, add_rvalue_reference_t< T > > |
|
template<bool Enable = !is_void_v<T>> |
constexpr auto | value () const &-> enable_if_t< Enable, add_lvalue_reference_t< const T > > |
|
template<bool Enable = !is_void_v<T>> |
constexpr auto | value () &-> enable_if_t< Enable, add_lvalue_reference_t< T > > |
|
template<bool Enable = !is_void_v<T>> |
constexpr auto | value () const &&-> enable_if_t< Enable, add_rvalue_reference_t< const T > > |
|
template<bool Enable = !is_void_v<T>> |
constexpr auto | value () &&-> enable_if_t< Enable, add_rvalue_reference_t< T > > |
|
template<bool Enable = is_void_v<T>, enable_if_t< Enable > * = nullptr> |
constexpr void | operator* () const noexcept |
| expected<void, E> specialization value observers
|
|
template<bool Enable = is_void_v<T>, enable_if_t< Enable > * = nullptr> |
constexpr void | value () const & |
|
template<bool Enable = is_void_v<T>, enable_if_t< Enable > * = nullptr> |
constexpr void | value () && |
|
constexpr const E & | error () const &noexcept |
| expected error observers
|
|
constexpr E & | error () &noexcept |
|
constexpr const E && | error () const &&noexcept |
|
constexpr E && | error () &&noexcept |
|
template<class U > |
constexpr auto | value_or (U &&) const &-> enable_if_t< Internal::sfinae_trigger_v< U > &&!is_void_v< T >, T > |
|
template<class U > |
constexpr auto | value_or (U &&) &&-> enable_if_t< Internal::sfinae_trigger_v< U > &&!is_void_v< T >, T > |
|
template<class... Args> |
constexpr decltype(auto) | emplace (Args &&... args) noexcept |
| expected emplace
|
|
template<class U , class... Args> |
constexpr decltype(auto) | emplace (initializer_list< U > il, Args &&... args) noexcept |
|
template<bool Enable> |
constexpr auto | operator* () const &noexcept -> enable_if_t< Enable, add_lvalue_reference_t< const T > > |
| expected value observers
|
|
template<bool Enable> |
constexpr auto | operator* () &noexcept -> enable_if_t< Enable, add_lvalue_reference_t< T > > |
|
template<bool Enable> |
constexpr auto | operator* () const &&noexcept -> enable_if_t< Enable, add_rvalue_reference_t< const T > > |
|
template<bool Enable> |
constexpr auto | operator* () &&noexcept -> enable_if_t< Enable, add_rvalue_reference_t< T > > |
|
template<bool Enable> |
constexpr auto | value () const &-> enable_if_t< Enable, add_lvalue_reference_t< const T > > |
|
template<bool Enable> |
constexpr auto | value () &-> enable_if_t< Enable, add_lvalue_reference_t< T > > |
|
template<bool Enable> |
constexpr auto | value () const &&-> enable_if_t< Enable, add_rvalue_reference_t< const T > > |
|
template<bool Enable> |
constexpr auto | value () &&-> enable_if_t< Enable, add_rvalue_reference_t< T > > |
|
template<bool Enable, enable_if_t< Enable > * > |
constexpr void | value () const & |
|
template<bool Enable, enable_if_t< Enable > * > |
constexpr void | value () && |
|
template<class U > |
constexpr auto | value_or (U &&value) const &-> enable_if_t< Internal::sfinae_trigger_v< U > &&!is_void_v< T >, T > |
|
template<class U > |
constexpr auto | value_or (U &&value) &&-> enable_if_t< Internal::sfinae_trigger_v< U > &&!is_void_v< T >, T > |
|
template<class T, class E>
class AZStd::expected< T, E >
Implementation of C++23 std::expected The AZ::Outcome class inherits from it with a few differences to the initial state AZStd::expected default constructs with the expected(success) value. AZStd::expected supports operator*, operator-> and emplace functions AZStd::expected does NOT support an error type of void, AZStd::optional<T> should be used instead AZ::Outcome default constructs with the failure(unexpected) value. AZ::Outcome also supports void error type, which is not needed, as in that case an AZStd::optional is a better choice differences from std::expected Since O3DE doesn't use exceptions, noexcept isn't used throughout the code. Therefore the constraints on needing types to be noexcept are not in the AZStd::expected implementation