用GCC 6.1检测概念TS
Detecting the Concepts TS with GCC 6.1
如何使用GCC 6.1检测概念TS的存在?
此页面建议在支持Concepts TS的实现中预定义宏__cpp_experimental_concepts
。但是,以下测试程序在带有-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
关键字将无法识别。)
有人知道有其他方法可以根据Concepts是否可用来有条件地编译代码吗?
对于GCC,正确的宏是__cpp_concepts
:
#ifdef __cpp_concepts
static_assert(false, "Concepts TS found");
#endif
据此,宏的名称在最近的一份草案中进行了更改。
正确的名称来自GCC支持页面(感谢Jonathan Wakely),但链接的草案(2015-02-09)仍然需要__cpp_experimental_concepts
(这很奇怪…)。然而,在最近的草案(2015-09-25)中,名称实际上已更改为__cpp_concepts
。
相关文章:
- 使用CMake检测支持的C++标准
- 当套接字连接断开时检测C/C++Unix
- 概念TS检查忽略私有访问修饰符
- C/C++预处理器是否可以检测一些编译器选项
- WMI检测进程创建事件-c++
- 基于树莓pi的tensorflow lite量化ssd目标检测
- 下面是我为检测链接列表中的循环而制作的代码
- 落砂模拟碰撞检测C++和SFML
- 我可以检测和更改 gcc/g++ 中结构的当前数据对齐设置吗?
- 为什么C++编译器没有检测到正确声明的类?
- 检测win32服务创建和删除的最佳方法
- 正在LLVM中检测整数比较条件
- 如何在鼠标挂钩过程中检测拖动
- 位移操作和位掩码未检测到重复字符
- 检测 COFF 对象文件中C++内联符号
- qmake:检测目标位宽(32 位或 64 位)
- 增强精神解析器规则以检测语句中的特殊结尾
- 用于C++的静态二进制检测或二进制重写工具和框架
- Tensorflow对象检测在Python和C++(OpenCV)之间有不同的结果
- 用GCC 6.1检测概念TS