Open 3D Engine AzCore API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
#include <expected.h>
Inherits AZStd::Internal::expected_storage_move_assignment< T, E, special_member_availability >.
Inherited by AZ::Outcome< void, AZStd::string > [private]
, and AZ::Outcome< void, VisitorError > [private]
.
Public Types | |
using | value_type = T |
using | error_type = E |
using | unexpected_type = unexpected< E > |
template<class U > | |
using | rebind = expected< U, error_type > |
Public Member Functions | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
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) More... | |
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 |
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<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 > |
Friends | |
constexpr friend void | swap (expected &x, expected &y) noexcept(noexcept(x.swap(y))) |
template<class T2 , class E2 > | |
constexpr friend bool | operator== (const expected &x, const expected< T2, E2 > &y) |
template<class T2 , class E2 > | |
constexpr friend bool | operator!= (const expected &x, const expected< T2, E2 > &y) |
template<class T2 > | |
constexpr friend bool | operator== (const expected &x, const T2 &value) |
template<class T2 > | |
constexpr friend bool | operator!= (const expected &x, const T2 &value) |
template<class E2 > | |
constexpr friend bool | operator== (const expected &x, const unexpected< E2 > &err) |
template<class E2 > | |
constexpr friend bool | operator!= (const expected &x, const unexpected< E2 > &err) |
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
|
constexprnoexcept |
AZStd::expected expected constructors
|
constexpr |
expected<U, G> copy conversion constructor
Direct initialization copy constructor Allows construction of an expected from a type that can direct initialize T
|
constexpr |
expected<U, G> move conversion constructor
Direct initialization move constructor The first class =
parameter check the condition for whether the constructor should be explicit The second class=
paramter checks the constraints on the constructor
|
explicitconstexpr |
expected<void, E> specialization for in-place constructor
expected<void, E> specializtion in-place constructor
|
constexprnoexcept |
emplace overload for when T is void
expected emplace for void type expected<void, E>
specialization It destroys the error value and set has_value() to true
|
explicitconstexprnoexcept |
Returns whether the expected contains a value type(true) or error type(false)
expected observer functions Returns whether the expected contains a value type(true) or error type(false)
|
constexpr |
Need to use the U template parameter in the enable_if_t check to defer evaluation until the function is instantiated.