diff --git a/cpp/mrc/include/mrc/core/concepts/not_void.hpp b/cpp/mrc/include/mrc/core/concepts/not_void.hpp index abc0bbf5e..78e86c13b 100644 --- a/cpp/mrc/include/mrc/core/concepts/not_void.hpp +++ b/cpp/mrc/include/mrc/core/concepts/not_void.hpp @@ -22,6 +22,6 @@ namespace mrc::core::concepts { template -concept not_void = requires { requires not std::same_as; }; +concept not_void = (not std::same_as); } // namespace mrc::core::concepts diff --git a/cpp/mrc/include/mrc/coroutines/concepts/awaitable.hpp b/cpp/mrc/include/mrc/coroutines/concepts/awaitable.hpp index 845699450..25a246a65 100644 --- a/cpp/mrc/include/mrc/coroutines/concepts/awaitable.hpp +++ b/cpp/mrc/include/mrc/coroutines/concepts/awaitable.hpp @@ -44,6 +44,14 @@ #include namespace mrc::coroutines::concepts { + +// clang-format off +/** + * The concept declares a type that is required to be one of the passed types + */ +template +concept one_of = (... or std::same_as); + /** * This concept declares a type that is required to meet the c++20 coroutine operator co_await() * retun type. It requires the following three member functions: @@ -52,14 +60,11 @@ namespace mrc::coroutines::concepts { * await_resume() -> decltype(auto) * Where the return type on await_resume is the requested return of the awaitable. */ -// clang-format off template concept awaiter = requires(T t, std::coroutine_handle<> c) { { t.await_ready() } -> std::same_as; - requires std::same_as || - std::same_as || - std::same_as>; + { t.await_suspend(c) } -> one_of>; { t.await_resume() }; }; @@ -77,10 +82,8 @@ template concept awaiter_void = requires(T t, std::coroutine_handle<> c) { { t.await_ready() } -> std::same_as; - requires std::same_as || - std::same_as || - std::same_as>; - {t.await_resume()} -> std::same_as; + { t.await_suspend(c) } -> one_of>; + { t.await_resume() } -> std::same_as; }; template