r*******y 发帖数: 1081 | 1 vector v1(10, 1);
vector v2(15, 1);
v1.swap(v2)
Here the swap costs constant time.
How does STL achieve this? thanks | a****l 发帖数: 8211 | 2 swap the pointer.
【在 r*******y 的大作中提到】 : vector v1(10, 1); : vector v2(15, 1); : v1.swap(v2) : Here the swap costs constant time. : How does STL achieve this? thanks
| r*******y 发帖数: 1081 | 3 thanks
【在 a****l 的大作中提到】 : swap the pointer.
|
|