Links are aliases. If you have two links, a swap call will replace what they reference, not the links themselves.
C& r1 = c1; // r1 references c1 C& r2 = c2; // r2 references c2 r1.swap(r2); // same as c1.swap(c2)
And these are not variables that change places, which makes them logically independent, which change places. If the container consists only of a pointer, if you swap that pointer with the pointer of another container, you are actually swapping the containers. The variables themselves remain.
Specific example:
typedef std::vector<int> vec; vec c1; vec c2;
source share