std::forward()
1.完美转发
完美转发实现了参数在传递过程中保持其值属性的功能,即若是左值,则传递之后仍然是左值,若是右值,则传递之后仍然是右值。
C++11 lets us perform perfect forwarding, which means that we can forward the parameters passed to a function template to another function call inside it without losing their own qualifiers(const-ref, ref, value, rvalue, etc.).
2.std::forward()解析
std::forward只有在它的参数绑定到一个右值上的时候,它才转换它的参数到一个右值。
原文链接:https://www.jianshu.com/p/b90d1091a4ff