> On 19 Jan 2015, at 11:50, Akim Demaille <a...@lrde.epita.fr> wrote:
> 
>> Le 19 janv. 2015 à 11:18, Hans Aberg <haber...@telia.com> a écrit :

>> Perhaps it is not needed: the compiler inserts std::move in code like:
>> int main () {
>> A a, b, c, d, e;
>> e = a*b + c*d;
> 
> Well, this is an rvalue, so it is expected to move the result.

By replacing, in the calc++ example, “int” with an “Int” class writing out the 
constructors, I get pairs of copy constructors in sequence on the same value, 
and one in each pair is due to
  basic_symbol (typename Base::kind_type t, const Int v, const location_type& 
l);
not having a reference: Int const&. The other, I do not know. Also there are 
same value assignments of the form “a = a”. (And std::swap results in three 
std::move instead of one if there is an assignment.)

But apart from that only std::move(). So it is quite close.



Reply via email to