book: import correct header

Fixes #192
Fixes #147
This commit is contained in:
Changkun Ou
2021-08-11 12:33:44 +02:00
parent 529399ffcd
commit e202554f16
3 changed files with 6 additions and 2 deletions

View File

@@ -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 <memory>
void lambda_expression_capture() {
auto important = std::make_unique<int>(1);
auto add = [v1 = 1, v2 = std::move(important)](int x, int y) -> int {

View File

@@ -90,7 +90,8 @@ C++14 给与了我们方便,允许捕获的成员用任意的表达式进行
```cpp
#include <iostream>
#include <utility>
#include <memory> // std::make_unique
#include <utility> // std::move
int main() {
auto important = std::make_unique<int>(1);

View File

@@ -9,7 +9,8 @@
#include <iostream>
#include <utility>
#include <memory> // std::make_unique
#include <utility> // std::move
void lambda_value_capture() {
int value = 1;