[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++11/14
From: |
Hans Aberg |
Subject: |
Re: C++11/14 |
Date: |
Mon, 19 Jan 2015 15:46:42 +0100 |
> On 19 Jan 2015, at 11:50, Akim Demaille <address@hidden> wrote:
>
>> Le 19 janv. 2015 à 11:18, Hans Aberg <address@hidden> 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.
- Re: C++11/14, (continued)
- Re: C++11/14, Hans Aberg, 2015/01/19
- Re: C++11/14, Akim Demaille, 2015/01/19
- Re: C++11/14, Hans Aberg, 2015/01/19
- Re: C++11/14, Akim Demaille, 2015/01/19
- Re: C++11/14, Hans Aberg, 2015/01/19
- Re: C++11/14, Hans Aberg, 2015/01/19
- Re: C++11/14, Akim Demaille, 2015/01/20
- Re: C++11/14, Hans Aberg, 2015/01/20
- Re: C++11/14, Hans Aberg, 2015/01/20
- Re: C++11/14, Hans Aberg, 2015/01/20
- Re: C++11/14,
Hans Aberg <=