【发布时间】:2020-09-08 18:26:23
【问题描述】:
我继承了以下内容:
template <typename T>
concept IsAwaiter = requires {
typename T::await_ready;
typename T::await_suspend;
typename T::await_resume;
};
template <typename ...AWAITABLES>
concept IsAwaitables = typename std::conjunction<IsAwaiter<AWAITABLES>...>::type;
使用 clang 10.0.0 构建它会导致以下错误:
IsAwaiter.h:43:50: error: template argument for template type parameter must be a type
也许只是一个简单的语法问题,但我发现很难找到一个示例来说明如何基于可变模板概念参数创建概念。
任何帮助表示赞赏!
【问题讨论】:
-
(IsAwaiter<AWAITABLES> && ...)? -
std::conjunction会打破包容顺便说一句。 -
很遗憾,编译器还不喜欢这个:(。模板元编程~.
-
根据您的建议,我尝试了
concept IsAwaitables = typename std::conjunction(IsAwaiter<AWAITABLES> && ...)::type;,但编译器以/home/dja/sandbox/experimental/rubicon/player/api/player/detail/IsAwaiter.h:43:24: error: no viable constructor or deduction guide for deduction of template arguments of 'conjunction'响应。我想这就是你的建议.. -
你为什么使用
conjunction?
标签: c++ c++20 variadic c++-concepts