提交 17ed103d 编写于 作者: 邹晓航

swap

上级 b7fc59cf
......@@ -206,13 +206,13 @@ namespace TinySTL{
delete[] map_;
}
private:
//T *getANewBuck(){
// return dataAllocator::allocate(getBuckSize());
//}
T *getANewBuck(){
return dataAllocator::allocate(getBuckSize());
}
T** getANewMap(const size_t size){
T **map = new T*[size];
for (int i = 0; i != size; ++i)
map[i] = dataAllocator::allocate(getBuckSize());
map[i] = getANewBuck();
return map;
}
size_t getNewMapSize(const size_t size){
......@@ -311,5 +311,12 @@ namespace TinySTL{
--end_;
dataAllocator::destroy(end_.cur_);
}
template<class T, class Alloc>
void deque<T, Alloc>::swap(deque& x){
TinySTL::swap(beg_, x.beg_);
TinySTL::swap(end_, x.end_);
TinySTL::swap(mapSize_, x.mapSize_);
TinySTL::swap(map_, x.map_);
}
}
#endif
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册