I don't understand why I see lines marked with arrows in console. I added c1 and c2 to vector with std::move. But when I was adding c3 and c4, I got extra copy constructor calling for c1 and for c1 and c2. WHY?!
Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
c1: meow!
c2: meow!
c3: meow!
c4: meow!
c1: !!!!
c2: !!!!
c1: ???? // <====
c3: ????
c1: ???? // <====
c2: ???? // <====
c4: ????
c1: say meow again
c2: say meow again
c3: say meow again
c4: say meow again
> But when I was adding c3 and c4, I got extra copy constructor calling for c1 and for c1 and c2. WHY?!
The move constructor for Cat is not declared as noexcept So the vector implementation is helpless; it can't safely move the objects from one buffer to another; it has to copy them.