regarding C++ stl container swap function
- by sm1
I recently learned that all stl containers have swap function:
i.e.
c1.swap(c2);
will lead to object underlying c1 being assigned to c2 and vice versa.
I asked my professor if same is true in case of c1 and c2 being references.
he said same mechanism is followed.
I wonder how it happens since c++ references cannot be reseted.