gpt4 book ai didi

c++ - 如何检查技术规范 (TS) 是否可用?

转载 作者:太空狗 更新时间:2023-10-29 21:39:24 28 4
gpt4 key购买 nike

许多新的 C++ 功能(例如模块或概念)可能不会出现在下一个标准 C++17 中,而是成为 Technical Specification 的一部分。 .

我们如何检查这样的 TS 是否可用?
是否/将有一个标准的方法?

最佳答案

每个技术规范都有自己的(一组)功能测试宏。

例如,文件系统 TS ( n4100/2014 ) 指定宏 __cpp_lib_experimental_filesystem在标题上<experimental/filesystem>为此:

5.2 Feature test macros [fs.req.macros]

2    Header <experimental/filesystem> shall supply the following macro definition:

         #define __cpp_lib_experimental_filesystem 201406

p0096r5为了我们的方便,有一个很好的所有此类宏的集合。

您可能需要事先使用 __has_include 检查必要的 header , 不过。

关于c++ - 如何检查技术规范 (TS) 是否可用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33065572/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com