On Tuesday, 28 April 2015 16:23:14 UTC+3, Juha Nieminen wrote:
> Stefan Ram <
r...@zedat.fu-berlin.de> wrote:
> > int main() { int && i = ::std::move( 3 ); ::std::cout << i << '\n'; }
>
> There is no difference between "something = std::move(something_else)"
> and "something = something_else" when that type has no move constructor.
'std::move' just returns a rvalue reference to its argument
and the "something" is rvalue reference so no constructors were
called in the process?
> As for having a reference to a temporary, the temporary will exist for
> as long as the reference (ie. the current scope).
Yes, that is true, so sane compiler just optimized the bloat away and
made "std::cout << 3 << '\n';" out of it.