Skip to main content
 首页 » 编程设计

c++11之完美转发之这是怎么回事

2024年05月10日7dudu

Possible Duplicate:
Advantages of using forward

有人可以向我解释一下什么是完美转发吗?

请您参考如下方法:

http://www.justsoftwaresolutions.co.uk/cplusplus/rvalue_references_and_perfect_forwarding.html

Why is this useful? Well, it means that a function template can pass its arguments through to another function whilst retaining the lvalue/rvalue nature of the function arguments by using std::forward. This is called "perfect forwarding", avoids excessive copying, and avoids the template author having to write multiple overloads for lvalue and rvalue references.