From 8ea7b15271d945021d6e4ddf1993aace2b3a8a2a Mon Sep 17 00:00:00 2001 From: OEOTYAN Date: Thu, 20 Jun 2024 18:11:35 +0800 Subject: [PATCH] fix: fix optional_ref at c++20 --- src/mc/common/wrapper/optional_ref.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mc/common/wrapper/optional_ref.h b/src/mc/common/wrapper/optional_ref.h index be87d3d961..75f7443fc1 100644 --- a/src/mc/common/wrapper/optional_ref.h +++ b/src/mc/common/wrapper/optional_ref.h @@ -113,6 +113,8 @@ class optional_ref { [[nodiscard]] constexpr decltype(auto) rbegin() const { return (get().rbegin()); } [[nodiscard]] constexpr decltype(auto) crend() const { return (get().crend()); } [[nodiscard]] constexpr decltype(auto) crbegin() const { return (get().crbegin()); } + +#if _HAS_CXX23 template constexpr auto and_then(Fn&& fn) const { using Ret = std::invoke_result_t; @@ -153,6 +155,7 @@ class optional_ref { return std::invoke(std::forward(fn)); } } +#endif // _HAS_CXX23 }; // NOLINTEND template