由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - How to implement swap of two containers in c++?
相关主题
STL vector的clear如何强制归还系统?question on reserve() in vector container.
请问释放容器内存的方法什么时候需要调用STL container的destructor?
Question on C++ Access Control (protected)问个很弱的stl的priority queue问题
c++ template question:C++ template
问一个有关C++里面list的问题。stl的一个问题
请问delete的问题问一下STL里的queue, and stack 遍历的问题 (转载)
anything like STL in C?弱弱的问问hash, hashtable? (转载)
Question about vector as a class memberC++ 普及课程 (视频):Introduction of STL
相关话题的讨论汇总
话题: swap话题: containers话题: implement
进入Programming版参与讨论
1 (共1页)
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.
1 (共1页)
进入Programming版参与讨论
相关主题
C++ 普及课程 (视频):Introduction of STL问一个有关C++里面list的问题。
Is it safe to use unique_ptr with STL container?请问delete的问题
C++ Q87: What is wrong with this swap function? (转载)anything like STL in C?
请教算法题Question about vector as a class member
STL vector的clear如何强制归还系统?question on reserve() in vector container.
请问释放容器内存的方法什么时候需要调用STL container的destructor?
Question on C++ Access Control (protected)问个很弱的stl的priority queue问题
c++ template question:C++ template
相关话题的讨论汇总
话题: swap话题: containers话题: implement