@@ -367,17 +367,18 @@ struct invocable_indirect_v {
367367};
368368
369369/* *
370- * @brief check whether the callable return types are all Result, ignored_type, or void
370+ * @brief check whether the callable return types are all Result
371+ *
372+ * @note if an ignored_type is present, it won't be evaluated
371373 *
372374 * @note helper for Result::or_else
373375 * @note concept is satisfied with ignored_type as well
374376 *
375377 * @tparam Ts the type to check
376378 */
377379template <typename R, typename F, typename ... Ts>
378- concept AllResultOrVoid =
380+ concept AllResult =
379381 ((IsResult<or_else_return_t <R, F, Ts>>
380- || std::same_as<void , std::remove_cvref_t <or_else_return_t <R, F, Ts>>>
381382 || std::same_as<ignored_type, std::remove_cvref_t <or_else_return_t <R, F, Ts>>>)
382383 && ...);
383384
@@ -516,12 +517,9 @@ class Result {
516517 *
517518 * constraints:
518519 * - Callable must be invocable with at least one error type as an argument
519- * - If the callable is invocable, it must always return the same type given different parameter
520- * types
521- * - The callable is only allowed to return a Result, or void
522- * - If a Result is returned, it must have the same value type as this Result instance
523- * - The return type of the callable must be the same for all possible arguments it may be
524- * called with.
520+ * - If invocable, the callable must always return the same type regardless of argument type
521+ * - If invocable, the callable must return a Result
522+ * - The Result returned by the callable must have the same value type
525523 *
526524 * @tparam Self deduced self type
527525 * @tparam F the type of the callable
@@ -532,10 +530,9 @@ class Result {
532530 requires traits::AnyInvocable<Self, F, Errs...>
533531 // the callable must always return the same type (if it's invocable)
534532 && traits::AllSame<traits::or_else_return_t <Self, F, Errs>...>
535- // the callable must return a Result or void (if it's invocable)
536- && traits::AllResultOrVoid<Self, F, Errs...>
537- // if the callable returns a Result, it must have the same value type as this
538- // Result instance
533+ // the callable must return a Result (if it's invocable)
534+ && traits::AllResult<Self, F, Errs...>
535+ // the Result returned by the callable must have the same value type
539536 && traits::AllValueTypeMatch<Self, traits::or_else_return_t <Self, F, Errs>...>
540537 constexpr auto or_else (this Self&& self, F&& f) {
541538 using namespace traits ;
@@ -720,12 +717,9 @@ class Result<void, Errs...> {
720717 *
721718 * constraints:
722719 * - Callable must be invocable with at least one error type as an argument
723- * - If the callable is invocable, it must always return the same type given different parameter
724- * types
725- * - The callable is only allowed to return a Result, or void
726- * - If a Result is returned, it must have the same value type as this Result instance
727- * - The return type of the callable must be the same for all possible arguments it may be
728- * called with.
720+ * - If invocable, the callable must always return the same type regardless of argument type
721+ * - If invocable, the callable must return a Result
722+ * - The Result returned by the callable must have the same value type
729723 *
730724 * @tparam Self deduced self type
731725 * @tparam F the type of the callable
@@ -736,10 +730,9 @@ class Result<void, Errs...> {
736730 requires traits::AnyInvocable<Self, F, Errs...>
737731 // the callable must always return the same type (if it's invocable)
738732 && traits::AllSame<traits::or_else_return_t <Self, F, Errs>...>
739- // the callable must return a Result or void (if it's invocable)
740- && traits::AllResultOrVoid<Self, F, Errs...>
741- // if the callable returns a Result, it must have the same value type as this
742- // Result instance
733+ // the callable must return a Result (if it's invocable)
734+ && traits::AllResult<Self, F, Errs...>
735+ // the Result returned by the callable must have the same value type
743736 && traits::AllValueTypeMatch<Self, traits::or_else_return_t <Self, F, Errs>...>
744737 constexpr auto or_else (this Self&& self, F&& f) {
745738 using namespace traits ;
0 commit comments