mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-17 12:44:40 +03:00
book: rephrease unique_ptr value capturing (#182)
This commit is contained in:
@@ -114,7 +114,7 @@ void lambda_expression_capture() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
In the above code, `important` is an exclusive pointer that cannot be caught.
|
In the above code, `important` is an exclusive pointer that cannot be caught by value capture using `=`.
|
||||||
At this time we need to transfer it to the rvalue and
|
At this time we need to transfer it to the rvalue and
|
||||||
initialize it in the expression.
|
initialize it in the expression.
|
||||||
|
|
||||||
|
|||||||
@@ -102,8 +102,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
在上面的代码中,`important` 是一个独占指针,是不能够被捕获到的,这时候我们需要将其转移为右值,
|
在上面的代码中,important 是一个独占指针,是不能够被 "=" 值捕获到,这时候我们可以将其转移为右值,在表达式中初始化。
|
||||||
在表达式中初始化。
|
|
||||||
|
|
||||||
### 泛型 Lambda
|
### 泛型 Lambda
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user