Lines Matching full:expected
61 class expected; variable
67 struct __is_std_expected<expected<_Tp, _Err>> : true_type {};
142 // This class implements the storage used by `std::expected`. We have a few
146 // expected, so as to save space.
147 // 2. Whenever the `expected<_Tp, _Unex>` as a whole has free bytes in its tail
148 // padding, we should allow an object following the expected to be stored in
151 // `expected<_Tp, _Unex>` to be stored in the padding bytes of the
203 // // complete `expected` object.
394 // In case we copy/move construct from another `expected` we need to create
395 // our `expected` so that it either has a value or not, depending on the "has
396 // value" flag of the other `expected`. To do this without falling back on
447 class expected : private __expected_base<_Tp, _Err> {
451 …"[expected.object.general] A program that instantiates the definition of template expected<T, E> f…
454 … "definition of the template expected<T, E> with a type for the E parameter that is not a valid "
458 friend class expected;
469 expected,
473 using rebind = expected<_Up, error_type>;
475 // [expected.object.ctor], constructors
476 …_LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept(is_nothrow_default_constructible_v<_Tp>) // st…
480 _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete;
482 _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&)
487 _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __other) noexcept(
493 _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&)
498 _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __other) noexcept(
512 _Not<is_constructible<_Tp, expected<_Up, _OtherErr>&>>,
513 _Not<is_constructible<_Tp, expected<_Up, _OtherErr>>>,
514 _Not<is_constructible<_Tp, const expected<_Up, _OtherErr>&>>,
515 _Not<is_constructible<_Tp, const expected<_Up, _OtherErr>>>,
516 _Not<is_convertible<expected<_Up, _OtherErr>&, _Tp>>,
517 _Not<is_convertible<expected<_Up, _OtherErr>&&, _Tp>>,
518 _Not<is_convertible<const expected<_Up, _OtherErr>&, _Tp>>,
519 _Not<is_convertible<const expected<_Up, _OtherErr>&&, _Tp>>>,
521 _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>&>>,
522 _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>>>,
523 _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>&>>,
524 _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>>> >;
527 _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(
532 _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(
541 expected(const expected<_Up, _OtherErr>& __other) noexcept(
549 expected(expected<_Up, _OtherErr>&& __other) noexcept(
554 …requires(!is_same_v<remove_cvref_t<_Up>, in_place_t> && !is_same_v<expected, remove_cvref_t<_Up>> …
558 expected(_Up&& __u) noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened
563 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(
570 …expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // …
575 _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, _Args&&... __args) noexcept(
581 …_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, initializer_list<_Up> __il, _Args&&.…
587 _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept(
593 …_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&.…
597 // [expected.object.dtor], destructor
599 _LIBCPP_HIDE_FROM_ABI constexpr ~expected() = default;
625 // [expected.object.assign], assignment
626 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete;
628 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) noexcept(
647 _LIBCPP_HIDE_FROM_ABI constexpr expected&
648 …operator=(expected&& __rhs) noexcept(is_nothrow_move_assignable_v<_Tp> && is_nothrow_move_construc…
667 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(_Up&& __v)
668 …requires(!is_same_v<expected, remove_cvref_t<_Up>> && !__is_std_unexpected<remove_cvref_t<_Up>>::v…
694 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const unexpected<_OtherErr>& __un) {
705 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(unexpected<_OtherErr>&& __un) {
731 // [expected.object.swap], swap
733 …swap(expected& __rhs) noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp>…
739 auto __swap_val_unex_impl = [](expected& __with_val, expected& __with_err) {
779 …_LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y) noexcept(noexcept(_…
785 // [expected.object.obs], observers
788 this->__has_val(), "expected::operator-> requires the expected to contain a value");
794 this->__has_val(), "expected::operator-> requires the expected to contain a value");
800 this->__has_val(), "expected::operator* requires the expected to contain a value");
806 this->__has_val(), "expected::operator* requires the expected to contain a value");
812 this->__has_val(), "expected::operator* requires the expected to contain a value");
818 this->__has_val(), "expected::operator* requires the expected to contain a value");
862 !this->__has_val(), "expected::error requires the expected to contain an error");
868 !this->__has_val(), "expected::error requires the expected to contain an error");
874 !this->__has_val(), "expected::error requires the expected to contain an error");
880 !this->__has_val(), "expected::error requires the expected to contain an error");
916 // [expected.void.monadic], monadic
921 …_is_std_expected<_Up>::value, "The result of f(**this) must be a specialization of std::expected");
923 "The result of f(**this) must have the same error_type as this expected");
934 …_is_std_expected<_Up>::value, "The result of f(**this) must be a specialization of std::expected");
936 "The result of f(**this) must have the same error_type as this expected");
948 …ected<_Up>::value, "The result of f(std::move(**this)) must be a specialization of std::expected");
950 … "The result of f(std::move(**this)) must have the same error_type as this expected");
962 …ected<_Up>::value, "The result of f(std::move(**this)) must be a specialization of std::expected");
964 … "The result of f(std::move(**this)) must have the same error_type as this expected");
975 …is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
977 "The result of f(error()) must have the same value_type as this expected");
988 …is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
990 "The result of f(error()) must have the same value_type as this expected");
1002 …cted<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
1004 … "The result of f(std::move(error())) must have the same value_type as this expected");
1016 …cted<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
1018 … "The result of f(std::move(error())) must have the same value_type as this expected");
1030 return expected<_Up, _Err>(unexpect, error());
1033 return expected<_Up, _Err>(
1037 return expected<_Up, _Err>();
1046 return expected<_Up, _Err>(unexpect, error());
1049 return expected<_Up, _Err>(
1053 return expected<_Up, _Err>();
1062 return expected<_Up, _Err>(unexpect, std::move(error()));
1065 return expected<_Up, _Err>(
1069 return expected<_Up, _Err>();
1078 return expected<_Up, _Err>(unexpect, std::move(error()));
1081 return expected<_Up, _Err>(
1085 return expected<_Up, _Err>();
1096 return expected<_Tp, _Gp>(in_place, this->__val());
1098 …return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(_…
1108 return expected<_Tp, _Gp>(in_place, this->__val());
1110 …return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(_…
1120 return expected<_Tp, _Gp>(in_place, std::move(this->__val()));
1122 return expected<_Tp, _Gp>(
1133 return expected<_Tp, _Gp>(in_place, std::move(this->__val()));
1135 return expected<_Tp, _Gp>(
1139 // [expected.object.eq], equality operators
1142 …_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E…
1155 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const _T2& __v) {
1160 …_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const unexpected<_E2>&…
1356 class expected<_Tp, _Err> : private __expected_void_base<_Err> {
1358 … "[expected.void.general] A program that instantiates expected<T, E> with a E that is not a "
1362 friend class expected;
1368 _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>&>>,
1369 _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>>>,
1370 _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>&>>,
1371 _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>>>>;
1381 using rebind = expected<_Up, error_type>;
1383 // [expected.void.ctor], constructors
1384 _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept : __base(in_place) {}
1386 _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete;
1388 _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&)
1392 _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __rhs) noexcept(
1397 _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&)
1401 …_LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __rhs) noexcept(is_nothrow_move_constructible_…
1408 expected(const expected<_Up, _OtherErr>& __rhs) noexcept(
1415 …expected(expected<_Up, _OtherErr>&& __rhs) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) /…
1420 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(
1427 …expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // …
1430 _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t) noexcept : __base(in_place) {}
1434 _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept(
1440 …_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&.…
1446 _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(
1451 // [expected.void.dtor], destructor
1453 _LIBCPP_HIDE_FROM_ABI constexpr ~expected() = default;
1474 // [expected.void.assign], assignment
1475 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete;
1477 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) noexcept(
1495 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&&) = delete;
1497 _LIBCPP_HIDE_FROM_ABI constexpr expected&
1498 …operator=(expected&& __rhs) noexcept(is_nothrow_move_assignable_v<_Err> && is_nothrow_move_constru…
1517 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const unexpected<_OtherErr>& __un) {
1528 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(unexpected<_OtherErr>&& __un) {
1543 // [expected.void.swap], swap
1545 …swap(expected& __rhs) noexcept(is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Er…
1548 auto __swap_val_unex_impl = [](expected& __with_val, expected& __with_err) {
1569 …_LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y) noexcept(noexcept(_…
1575 // [expected.void.obs], observers
1582 this->__has_val(), "expected::operator* requires the expected to contain a value");
1601 !this->__has_val(), "expected::error requires the expected to contain an error");
1607 !this->__has_val(), "expected::error requires the expected to contain an error");
1613 !this->__has_val(), "expected::error requires the expected to contain an error");
1619 !this->__has_val(), "expected::error requires the expected to contain an error");
1643 // [expected.void.monadic], monadic
1648 …sert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
1650 …pename _Up::error_type, _Err>, "The result of f() must have the same error_type as this expected");
1661 …sert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
1663 …pename _Up::error_type, _Err>, "The result of f() must have the same error_type as this expected");
1674 …sert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
1676 …pename _Up::error_type, _Err>, "The result of f() must have the same error_type as this expected");
1687 …sert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
1689 …pename _Up::error_type, _Err>, "The result of f() must have the same error_type as this expected");
1699 …is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
1701 "The result of f(error()) must have the same value_type as this expected");
1711 …is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
1713 "The result of f(error()) must have the same value_type as this expected");
1724 …cted<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
1726 … "The result of f(std::move(error())) must have the same value_type as this expected");
1737 …cted<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
1739 … "The result of f(std::move(error())) must have the same value_type as this expected");
1751 return expected<_Up, _Err>(unexpect, error());
1754 …return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__…
1757 return expected<_Up, _Err>();
1766 return expected<_Up, _Err>(unexpect, error());
1769 …return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__…
1772 return expected<_Up, _Err>();
1781 return expected<_Up, _Err>(unexpect, std::move(error()));
1784 …return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__…
1787 return expected<_Up, _Err>();
1796 return expected<_Up, _Err>(unexpect, std::move(error()));
1799 …return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__…
1802 return expected<_Up, _Err>();
1812 return expected<_Tp, _Gp>();
1814 …return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(_…
1823 return expected<_Tp, _Gp>();
1825 …return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(_…
1834 return expected<_Tp, _Gp>();
1836 return expected<_Tp, _Gp>(
1846 return expected<_Tp, _Gp>();
1848 return expected<_Tp, _Gp>(
1852 // [expected.void.eq], equality operators
1855 …_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E…
1864 …_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const unexpected<_E2>&…