diff --git a/book/en-us/03-runtime.md b/book/en-us/03-runtime.md index f7a71c9..b11c9bb 100644 --- a/book/en-us/03-runtime.md +++ b/book/en-us/03-runtime.md @@ -105,6 +105,8 @@ The type of the captured variable being declared is judged according to the expr and the judgment is the same as using `auto`: ```cpp +#include + void lambda_expression_capture() { auto important = std::make_unique(1); auto add = [v1 = 1, v2 = std::move(important)](int x, int y) -> int { diff --git a/book/zh-cn/03-runtime.md b/book/zh-cn/03-runtime.md index 2b8a76f..7752c9c 100644 --- a/book/zh-cn/03-runtime.md +++ b/book/zh-cn/03-runtime.md @@ -90,7 +90,8 @@ C++14 给与了我们方便,允许捕获的成员用任意的表达式进行 ```cpp #include -#include +#include // std::make_unique +#include // std::move int main() { auto important = std::make_unique(1); diff --git a/code/3/3.1.lambda.basic.cpp b/code/3/3.1.lambda.basic.cpp index 085dadc..a0b8063 100644 --- a/code/3/3.1.lambda.basic.cpp +++ b/code/3/3.1.lambda.basic.cpp @@ -9,7 +9,8 @@ #include -#include +#include // std::make_unique +#include // std::move void lambda_value_capture() { int value = 1;