如何使用 GCC 6.1 检测 Concepts TS 的存在?
此页面建议__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
关键字无法识别。)
有谁知道根据概念是否可用有条件地编译代码的任何其他方法?