|
Boost : |
Subject: Re: [boost] rvalue ref best practices?
From: Peter Dimov (pdimov_at_[hidden])
Date: 2012-06-11 07:35:46
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk