diff --git a/libcxx/include/optional b/libcxx/include/optional index 2499479348892..ffa071c2304ba 100644 --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -757,9 +757,10 @@ concept __is_derived_from_optional = requires(const _Tp& __t) { [](co # endif // _LIBCPP_STD_VER >= 20 template -struct __is_std_optional : false_type {}; +inline constexpr bool __is_std_optional_v = false; + template -struct __is_std_optional> : true_type {}; +inline constexpr bool __is_std_optional_v> = true; # if _LIBCPP_STD_VER < 26 template @@ -903,7 +904,7 @@ private: template using _CheckOptionalArgsCtor _LIBCPP_NODEBUG = _If< _IsNotSame<__remove_cvref_t<_Up>, in_place_t>::value && _IsNotSame<__remove_cvref_t<_Up>, optional>::value && - (!is_same_v, bool> || !__is_std_optional<__remove_cvref_t<_Up>>::value), + (!is_same_v, bool> || !__is_std_optional_v<__remove_cvref_t<_Up>>), _CheckOptionalArgsConstructor, __check_tuple_constructor_fail >; template @@ -1093,8 +1094,8 @@ public: template [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & { using _Up = invoke_result_t<_Func, _Tp&>; - static_assert(__is_std_optional>::value, - "Result of f(value()) must be a specialization of std::optional"); + static_assert( + __is_std_optional_v>, "Result of f(value()) must be a specialization of std::optional"); if (*this) return std::invoke(std::forward<_Func>(__f), value()); return remove_cvref_t<_Up>(); @@ -1103,8 +1104,8 @@ public: template [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& { using _Up = invoke_result_t<_Func, const _Tp&>; - static_assert(__is_std_optional>::value, - "Result of f(value()) must be a specialization of std::optional"); + static_assert( + __is_std_optional_v>, "Result of f(value()) must be a specialization of std::optional"); if (*this) return std::invoke(std::forward<_Func>(__f), value()); return remove_cvref_t<_Up>(); @@ -1113,7 +1114,7 @@ public: template [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && { using _Up = invoke_result_t<_Func, _Tp&&>; - static_assert(__is_std_optional>::value, + static_assert(__is_std_optional_v>, "Result of f(std::move(value())) must be a specialization of std::optional"); if (*this) return std::invoke(std::forward<_Func>(__f), std::move(value())); @@ -1123,7 +1124,7 @@ public: template [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& { using _Up = invoke_result_t<_Func, const _Tp&&>; - static_assert(__is_std_optional>::value, + static_assert(__is_std_optional_v>, "Result of f(std::move(value())) must be a specialization of std::optional"); if (*this) return std::invoke(std::forward<_Func>(__f), std::move(value())); @@ -1338,8 +1339,8 @@ public: template [[nodiscard]] constexpr auto and_then(_Func&& __f) const { using _Up = invoke_result_t<_Func, _Tp&>; - static_assert(__is_std_optional>::value, - "Result of f(value()) must be a specialization of std::optional"); + static_assert( + __is_std_optional_v>, "Result of f(value()) must be a specialization of std::optional"); if (*this) return std::invoke(std::forward<_Func>(__f), value()); return remove_cvref_t<_Up>();