
11 Jun
2012
11 Jun
'12
11:35 a.m.
Mathias Gaunard wrote:
According to this rule, I should pass by value whenever I want to copy the variable anyway.
template<class T> struct foo { T t; foo(T t_) : t(t_) {} };
t( std::move( t_ ) ). In this case you can also std::forward, of course, this being a textbook example of forwarding, but then everything becomes convertible to foo, enter enable_if, and so on.