[libcxx-commits] [libcxx] [libc++] P3798R1: The unexpected in std::expected (PR #204826)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jun 21 18:10:58 PDT 2026
================
@@ -1599,6 +1603,10 @@ class expected<_Tp, _Err> : private __expected_void_base<_Err> {
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
+# if _LIBCPP_STD_VER >= 29
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_error() const noexcept { return !this->has_value(); }
+# endif
----------------
frederick-vs-ja wrote:
```suggestion
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_error() const noexcept { return !this->has_value(); }
```
https://github.com/llvm/llvm-project/pull/204826
More information about the libcxx-commits
mailing list