From d3a872cc3f0a7cde11b9ab2b59e20a50a290aa0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Kr=C3=BCgler?=
+Several people preferred to replace operator*() by the corresponding union members, so this part of the proposed wording +has been adjusted, which is a rather mechanical replacement. +
@@ -44,7 +50,7 @@ template<class F> constexpr auto and_then(F&& f) const &;-[Drafting note: Effectively replace all occurrences of **this by operator*().] +[Drafting note: Effectively replace all occurrences of **this by val.]
--1- Let U be remove_cvref_t<invoke_result_t<F, decltype(
-2- […] @@ -54,7 +60,7 @@ template<class F> constexpr auto and_then(F&& f) const &;**thisoperator*())>>. +-1- Let U be remove_cvref_t<invoke_result_t<F, decltype(**thisval)>>.@@ -65,7 +71,7 @@ template<class F> constexpr auto and_then(F&& f) const &&;if (has_value()) - return invoke(std::forward<F>(f),**thisoperator*()); + return invoke(std::forward<F>(f),**thisval); else return U(unexpect, error());--5- Let U be remove_cvref_t<invoke_result_t<F, decltype((std::move(
-6- […] @@ -75,7 +81,7 @@ template<class F> constexpr auto and_then(F&& f) const &&;**thisoperator*()))>>. +-5- Let U be remove_cvref_t<invoke_result_t<F, decltype((std::move(**thisval))>>.@@ -88,7 +94,7 @@ template<class F> constexpr auto or_else(F&& f) const &;if (has_value()) - return invoke(std::forward<F>(f), std::move(**thisoperator*())); + return invoke(std::forward<F>(f), std::move(**thisval)); else return U(unexpect, std::move(error()));-9- Let G be remove_cvref_t<invoke_result_t<F, decltype(error())>>.
--10- Constraints: is_constructible_v<T, decltype(**thisoperator*())> is true. +-10- Constraints: is_constructible_v<T, decltype(**thisval)> is true. -11- […] @@ -96,7 +102,7 @@ template<class F> constexpr auto or_else(F&& f) const &;@@ -109,7 +115,7 @@ template<class F> constexpr auto or_else(F&& f) const &&;if (has_value()) - return G(in_place,**thisoperator*()); + return G(in_place,**thisval); else return invoke(std::forward<F>(f), error());-13- Let G be remove_cvref_t<invoke_result_t<F, decltype(std::move(error()))>>.
--14- Constraints: is_constructible_v<T, decltype(std::move(**thisoperator*()))> is true. +-14- Constraints: is_constructible_v<T, decltype(std::move(**thisval))> is true. -15- […] @@ -117,7 +123,7 @@ template<class F> constexpr auto or_else(F&& f) const &&;@@ -128,7 +134,7 @@ template<class F> constexpr auto transform(F&& f) const &;if (has_value()) - return G(in_place, std::move(**thisoperator*())); + return G(in_place, std::move(**thisval)); else return invoke(std::forward<F>(f), std::move(error()));@@ -158,7 +164,7 @@ template<class F> constexpr auto transform(F&& f) const &&--17- Let U be remove_cvref_t<invoke_result_t<F, decltype(
-18- […] @@ -136,7 +142,7 @@ template<class F> constexpr auto transform(F&& f) const &; the declaration**thisoperator*())>>. +-17- Let U be remove_cvref_t<invoke_result_t<F, decltype(**thisval)>>.-U u(invoke(std::forward<F>(f),**thisoperator*())); +U u(invoke(std::forward<F>(f),**thisval));is well-formed. @@ -147,8 +153,8 @@ is well-formed.
(20.1) — […]
- (20.2) — Otherwise, if is_void_v<U> is false, returns an expected<U, E> object whose has_val member is true and val member is direct-non-list-initialized -with invoke(std::forward<F>(f),
**thisoperator*()).+ (20.3) — Otherwise, evaluates invoke(std::forward<F>(f),
**thisoperator*()) +with invoke(std::forward<F>(f),**thisval).(20.3) — Otherwise, evaluates invoke(std::forward<F>(f),
**thisval) and then returns expected<U, E>().@@ -190,11 +196,11 @@ template<class F> constexpr auto transform_error(F&& f) const &--21- Let U be remove_cvref_t<invoke_result_t<F, decltype(std::move(
-22- […] @@ -166,7 +172,7 @@ template<class F> constexpr auto transform(F&& f) const && the declaration**thisoperator*()))>>. +-21- Let U be remove_cvref_t<invoke_result_t<F, decltype(std::move(**thisval))>>.-U u(invoke(std::forward<F>(f), std::move(**thisoperator*()))); +U u(invoke(std::forward<F>(f), std::move(**thisval)));is well-formed. @@ -177,8 +183,8 @@ is well-formed.
(24.1) — […]
- (24.2) — Otherwise, if is_void_v<U> is false, returns an expected<U, E> object whose has_val member is true and val member is direct-non-list-initialized -with invoke(std::forward<F>(f), std::move(
**thisoperator*())).+ (24.3) — Otherwise, evaluates invoke(std::forward<F>(f), std::move(
**thisoperator*())) +with invoke(std::forward<F>(f), std::move(**thisval)).(24.3) — Otherwise, evaluates invoke(std::forward<F>(f), std::move(
**thisval)) and then returns expected<U, E>().-25- Let G be remove_cvref_t<invoke_result_t<F, decltype(error())>>.
--26- Constraints: is_constructible_v<T, decltype(**thisoperator*())> is true. +-26- Constraints: is_constructible_v<T, decltype(**thisval)> is true. -27- Mandates: […] --28- Returns: If has_value() is true, expected<T, G>(in_place,**thisoperator*()); +-28- Returns: If has_value() is true, expected<T, G>(in_place,**thisval); otherwise, an expected<T, G> object whose has_val member is false and unex member is direct-non-list-initialized with invoke(std::forward<F>(f), error()). @@ -207,11 +213,11 @@ template<class F> constexpr auto transform_error(F&& f) const &-29- Let G be remove_cvref_t<invoke_result_t<F, decltype(std::move(error()))>>.
--30- Constraints: is_constructible_v<T, decltype(std::move(**thisoperator*()))> is true. +-30- Constraints: is_constructible_v<T, decltype(std::move(**thisval))> is true. -31- Mandates: […] --32- Returns: If has_value() is true, expected<T, G>(in_place, std::move(**thisoperator*())); +-32- Returns: If has_value() is true, expected<T, G>(in_place, std::move(**thisval)); otherwise, an expected<T, G> object whose has_val member is false and unex member is direct-non-list-initialized with invoke(std::forward<F>(f), std::move(error())). @@ -224,7 +230,7 @@ otherwise, an expected<T, G> object whose has_val@@ -235,7 +241,7 @@ template<class F> constexpr auto and_then(F&& f) const &;-[Drafting note: Effectively replace all occurrences of value() by operator*().] +[Drafting note: Effectively replace all occurrences of value() by *val.]
--1- Let U be invoke_result_t<F, decltype(
-2- […] @@ -243,7 +249,7 @@ template<class F> constexpr auto and_then(F&& f) const &;value()operator*())>. +-1- Let U be invoke_result_t<F, decltype(value()*val)>.if (*this) { - return invoke(std::forward<F>(f),value()operator*()); + return invoke(std::forward<F>(f),value()*val); } else { return remove_cvref_t<U>(); } @@ -255,7 +261,7 @@ template<class F> constexpr auto and_then(F&& f) const &&;--4- Let U be invoke_result_t<F, decltype(std::move(
-5- […] @@ -263,7 +269,7 @@ template<class F> constexpr auto and_then(F&& f) const &&;value()operator*()))>. +-4- Let U be invoke_result_t<F, decltype(std::move(value()*val))>.if (*this) { - return invoke(std::forward<F>(f), std::move(value()operator*())); + return invoke(std::forward<F>(f), std::move(value()*val)); } else { return remove_cvref_t<U>(); } @@ -275,12 +281,12 @@ template<class F> constexpr auto transform(F&& f) const &;@@ -298,12 +304,12 @@ template<class F> constexpr auto transform(F&& f) const &&--7- Let U be remove_cv_t<invoke_result_t<F, decltype(
-8- Mandates: U is a non-array object type other than in_place_t or nullopt_t. The declarationvalue()operator*())>>. +-7- Let U be remove_cv_t<invoke_result_t<F, decltype(value()*val)>>.-U u(invoke(std::forward<F>(f),value()operator*())); +U u(invoke(std::forward<F>(f),value()*val));is well-formed for some invented variable u. @@ -288,7 +294,7 @@ is well-formed for some invented variable u. […]
-9- Returns: If *this contains a value, an optional<U> object whose contained value is -direct-non-list-initialized with invoke(std::forward<F>(f),value()operator*()); otherwise, +direct-non-list-initialized with invoke(std::forward<F>(f),value()*val); otherwise, optional<U>().--10- Let U be remove_cv_t<invoke_result_t<F, decltype(std::move(
-11- Mandates: U is a non-array object type other than in_place_t or nullopt_t. The declarationvalue()operator*()))>>. +-10- Let U be remove_cv_t<invoke_result_t<F, decltype(std::move(value()*val))>>.-U u(invoke(std::forward<F>(f), std::move(value()operator*()))); +U u(invoke(std::forward<F>(f), std::move(value()*val)));is well-formed for some invented variable u. @@ -311,7 +317,7 @@ is well-formed for some invented variable u. […]
-12- Returns: If *this contains a value, an optional<U> object whose contained value is -direct-non-list-initialized with invoke(std::forward<F>(f), std::move(value()operator*())); otherwise, +direct-non-list-initialized with invoke(std::forward<F>(f), std::move(value()*val)); otherwise, optional<U>().