You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/en-us/03-runtime.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -529,7 +529,7 @@ both lvalue and rvalue. But follow the rules below:
529
529
| T&& | rvalue ref | T&& |
530
530
531
531
Therefore, the use of `T&&` in a template function may not be able to make an rvalue reference, and when a lvalue is passed, a reference to this function will be derived as an lvalue.
532
-
More precisely, **no matter what type of reference the template parameter is, the template parameter can be derived as a right reference type** if and only if the argument type is a right reference.
532
+
More precisely, **no matter what type of reference the template parameter is, the template parameter can be derived as a right reference type** if and only if the argument type is a right reference.
533
533
This makes `v` successful delivery of lvalues.
534
534
535
535
Perfect forwarding is based on the above rules. The so-called perfect forwarding is to let us pass the parameters,
Regardless of whether the pass parameter is an lvalue or an rvalue, the normal pass argument will forward the argument as an lvalue.
587
587
So `std::move` will always accept an lvalue, which forwards the call to `reference(int&&)` to output the rvalue reference.
588
588
589
-
Only `std::forward` does not cause any extra copies and **perfectly forwards** (passes) the arguments of the function to other functions that are called internally.
589
+
Only `std::forward` does not cause any extra copies and **perfectly forwards** (passes) the arguments of the function to other functions that are called internally.
590
590
591
591
`std::forward` is the same as `std::move`, and nothing is done. `std::move` simply converts the lvalue to the rvalue.
592
592
`std::forward` is just a simple conversion of the parameters. From the point of view of the phenomenon,
0 commit comments