【发布时间】:2016-07-20 11:13:55
【问题描述】:
如何使用 GCC 6.1 检测是否存在 Concepts TS?
This page 建议宏 __cpp_experimental_concepts 应该在支持概念 TS 的实现中预定义。但是,以下测试程序在带有 -fconcepts 标志的 GCC 6.1 上编译没有错误:
#ifdef __cpp_experimental_concepts
static_assert(false, "Concepts TS found");
#endif
template <typename T>
concept bool Identity = true;
int main() {}
(我希望static_assert 被触发,或者concept 关键字无法识别。)
有没有人知道根据概念是否可用有条件地编译代码的任何其他方法?
【问题讨论】:
-
你可以通过
echo | g++ -E -dM -fconcepts -x c++ - | fgrep concepts找到宏
标签: c++ g++ c++-concepts