Skip to content

Commit 7b83b1d

Browse files
add some static_assert msg
1 parent 4c5cd80 commit 7b83b1d

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
@@ -532,10 +532,10 @@ class optional {
532532
template <class F>
533533
constexpr auto transform(F&& f) & {
534534
using U = std::invoke_result_t<F, T&>;
535-
static_assert(!std::is_array_v<U>);
536-
static_assert(!std::is_same_v<U, in_place_t>);
537-
static_assert(!std::is_same_v<U, nullopt_t>);
538-
static_assert(std::is_object_v<U> || std::is_reference_v<U>); /// References now allowed
535+
static_assert(!std::is_array_v<U>, "U must not be an array");
536+
static_assert(!std::is_same_v<U, in_place_t>, "U must not be an inplace type");
537+
static_assert(!std::is_same_v<U, nullopt_t>, "U must not be nullopt_t");
538+
static_assert(std::is_object_v<U> || std::is_reference_v<U>, "U must be either an object or a reference"); /// References now allowed
539539
return (has_value()) ? optional<U>{std::invoke(std::forward<F>(f), value_)} : optional<U>{};
540540
}
541541

0 commit comments

Comments
 (0)