Perfect forwarding - what's it all about?
C++11TerminologyPerfect ForwardingC++11 Problem Overview
> Possible Duplicate:
> Advantages of using forward
Could someone please explain to me what perfect forwarding is about?
C++11 Solutions
Solution 1 - C++11
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.
Solution 2 - C++11
Quoting Session Announcement: Adventures in Perfect Forwarding:
> Perfecting forwarding is an important C++0x technique built atop > rvalue references. It allows move semantics to be automatically > applied, even when the source and the destination of a move are > separated by intervening function calls. Common examples include > constructors and setter functions that forward arguments they receive > to the data members of the class they are initializing or setting, as > well as standard library functions like make_shared, which > “perfect-forwards” its arguments to the class constructor of whatever > object the to-be-created shared_ptr is to point to.