Hi Olivier, On 04/25/2012 01:12 PM, Olivier Goffart wrote: > The solution is actually much simpler: > > void Foo::setText(QString text) { > d_ptr->text = std::move(text); // no copy > } > > foo->setText(tr("hello world")); // no copy here, this is a move.
I understand why there wouldn't be a copy in the implementation of setText, but why wouldn't calling foo->setText() produce a copy? How can the compiler know that it must not create a copy when calling Foo::setText(QString text) unless we are inlining it? Ciao, Alberto -- http://blog.mardy.it <- geek in un lingua international! _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development