@@ -487,7 +487,7 @@ class optional {
487
487
template <class F >
488
488
constexpr auto and_then (F&& f) & {
489
489
using U = std::invoke_result_t <F, T&>;
490
- static_assert (detail::is_optional<std::remove_cvref_t <U>>);
490
+ static_assert (detail::is_optional<std::remove_cvref_t <U>>, " F must return an optional " );
491
491
if (has_value ()) {
492
492
return std::invoke (std::forward<F>(f), value_);
493
493
} else {
@@ -498,7 +498,7 @@ class optional {
498
498
template <class F >
499
499
constexpr auto and_then (F&& f) && {
500
500
using U = std::invoke_result_t <F, T&&>;
501
- static_assert (detail::is_optional<std::remove_cvref_t <U>>);
501
+ static_assert (detail::is_optional<std::remove_cvref_t <U>>, " F must return an optional " );
502
502
if (has_value ()) {
503
503
return std::invoke (std::forward<F>(f), std::move (value_));
504
504
} else {
@@ -509,7 +509,7 @@ class optional {
509
509
template <class F >
510
510
constexpr auto and_then (F&& f) const & {
511
511
using U = std::invoke_result_t <F, const T&>;
512
- static_assert (detail::is_optional<std::remove_cvref_t <U>>);
512
+ static_assert (detail::is_optional<std::remove_cvref_t <U>>, " F must return an optional " );
513
513
if (has_value ()) {
514
514
return std::invoke (std::forward<F>(f), value_);
515
515
} else {
@@ -520,7 +520,7 @@ class optional {
520
520
template <class F >
521
521
constexpr auto and_then (F&& f) const && {
522
522
using U = std::invoke_result_t <F, const T&&>;
523
- static_assert (detail::is_optional<std::remove_cvref_t <U>>);
523
+ static_assert (detail::is_optional<std::remove_cvref_t <U>>, " F must return an optional " );
524
524
if (has_value ()) {
525
525
return std::invoke (std::forward<F>(f), std::move (value_));
526
526
} else {
0 commit comments