Skip to content

Commit c554a25

Browse files
more message
1 parent 94bff02 commit c554a25

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/beman/optional26/optional.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ class optional {
487487
template <class F>
488488
constexpr auto and_then(F&& f) & {
489489
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");
491491
if (has_value()) {
492492
return std::invoke(std::forward<F>(f), value_);
493493
} else {
@@ -498,7 +498,7 @@ class optional {
498498
template <class F>
499499
constexpr auto and_then(F&& f) && {
500500
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");
502502
if (has_value()) {
503503
return std::invoke(std::forward<F>(f), std::move(value_));
504504
} else {
@@ -509,7 +509,7 @@ class optional {
509509
template <class F>
510510
constexpr auto and_then(F&& f) const& {
511511
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");
513513
if (has_value()) {
514514
return std::invoke(std::forward<F>(f), value_);
515515
} else {
@@ -520,7 +520,7 @@ class optional {
520520
template <class F>
521521
constexpr auto and_then(F&& f) const&& {
522522
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");
524524
if (has_value()) {
525525
return std::invoke(std::forward<F>(f), std::move(value_));
526526
} else {

0 commit comments

Comments
 (0)