From e202554f1655777d9b3515d0b7dbe41f0bbf3fb1 Mon Sep 17 00:00:00 2001 From: Changkun Ou Date: Wed, 11 Aug 2021 12:33:44 +0200 Subject: [PATCH] book: import correct header Fixes #192 Fixes #147 --- book/en-us/03-runtime.md | 2 ++ book/zh-cn/03-runtime.md | 3 ++- code/3/3.1.lambda.basic.cpp | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) 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;