aboutsummaryrefslogtreecommitdiff
path: root/zh/manual.md
diff options
context:
space:
mode:
Diffstat (limited to 'zh/manual.md')
-rw-r--r--zh/manual.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/zh/manual.md b/zh/manual.md
index 90d4365b..427c8c43 100644
--- a/zh/manual.md
+++ b/zh/manual.md
@@ -3409,9 +3409,11 @@ target("test")
```lua
option("constexpr")
- add_cxxsnippet("constexpr int f(int x) { int sum=0; for (int i=0; i<=x; ++i) sum += i; return sum; } constexpr int x = f(5); static_assert(x == 15);")
+ add_cxxsnippet("constexpr", "constexpr int f(int x) { int sum=0; for (int i=0; i<=x; ++i) sum += i; return sum; } constexpr int x = f(5); static_assert(x == 15);")
```
+第一个参数设置代码片段的名字作为标示,检测输出信息时候会有显示。
+
上述代码,实现对c++的constexpr特性的检测,如果检测通过,则启用constexpr选项,当然这里只是个例子。
对于编译器特性的检测,有更加方便高效的检测模块,提供更强大的检测支持,具体见:[compiler.has_features](#compiler-has_features)和[detect.check_cxsnippets](#detect-check_cxsnippets)