James Kanze wrote:
> On Sep 18, 1:15 am, er <erwann.rog...@gmail.com> wrote:
>
>> i'm wondering what is the role of A::operator= below in doing:
>> Impl impl0(0);
>> A a0(impl0);
>> std::vector<A> vec;
>> vec.push_back(a0);
>
>> if i put it as private the compiler complains but if i put it as
>> public, the message "A::operator=" does not appear. the message
>> "A::A(A&)" however does print.
>
> The standard says that any object put into a standard container
> must be assignable. That doesn't mean that the assignment
> operator will be called for all operations on the container.
>
Yes and the standard also says the objects must be copy constructable.
The copy constructor obviously is what is moving the object into the
container.