constructor · 15 overloads
std::expected::expected
- Header
<expected>- Scope
std::expected- cppreference
- std::expected nearest page
Constructors
Overloads
- (1)
constexpr expected() requires is_default_constructible_v<T>; - (2)
constexpr expected( const expected& other) noexcept(nothrow_copy) = default requires copy_ok && trivial_copy; - (3)
constexpr expected(const expected& other) = delete requires (!copy_ok); - (4)
constexpr expected( const expected& rhs) noexcept(nothrow_copy) requires copy_ok && (!trivial_copy); - (5)
template<class U, class G> requires (!is_void_v<U>) && expected-converts-from<T, E, U, G, const U&, const G&> explicit(!is_convertible_v<const U &, T> || !is_convertible_v<const G &, E>) constexpr expected( const expected<U, G>& rhs); - (6)
constexpr expected( expected&& other) noexcept(nothrow_move) = default requires move_ok && trivial_move; - (7)
constexpr expected(expected&& rhs) noexcept(nothrow_move) requires move_ok && (!trivial_move); - (8)
template<class U, class G> requires (!is_void_v<U>) && expected-converts-from<T, E, U, G, U, G> explicit(!is_convertible_v<U, T> || !is_convertible_v<G, E>) constexpr expected( expected<U, G>&& rhs); - (9)
template<class G> requires is_constructible_v<E, const G&> explicit(!is_convertible_v<const G &, E>) constexpr expected(const unexpected<G>& e); - (10)
template<class U = remove_cv_t<T>> requires (!is_same_v<remove_cvref_t<U>, in_place_t>) && (!is_same_v<remove_cvref_t<U>, expected>) && (!is_same_v<remove_cvref_t<U>, unexpect_t>) && (!is-unexpected<remove_cvref_t<U>>) && is_constructible_v<T, U> && (!is_same_v<remove_cv_t<T>, bool> || !is-expected<remove_cvref_t<U>>) explicit(!is_convertible_v<U, T>) constexpr expected(U&& v); - (11)
template<class G> requires is_constructible_v<E, G> explicit(!is_convertible_v<G, E>) constexpr expected(unexpected<G>&& e); - (12)
template<class... Args> requires is_constructible_v<T, Args...> explicit constexpr expected(in_place_t, Args&&... args); - (13)
template<class... Args> requires is_constructible_v<E, Args...> explicit constexpr expected(unexpect_t, Args&&... args); - (14)
template<class U, class... Args> requires is_constructible_v<T, initializer_list<U>&, Args...> explicit constexpr expected( in_place_t, initializer_list<U> il, Args&&... args); - (15)
template<class U, class... Args> requires is_constructible_v<E, initializer_list<U>&, Args...> explicit constexpr expected( unexpect_t, initializer_list<U> il, Args&&... args);