swap
This commit is contained in:
@@ -206,13 +206,13 @@ namespace TinySTL{
|
|||||||
delete[] map_;
|
delete[] map_;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
//T *getANewBuck(){
|
T *getANewBuck(){
|
||||||
// return dataAllocator::allocate(getBuckSize());
|
return dataAllocator::allocate(getBuckSize());
|
||||||
//}
|
}
|
||||||
T** getANewMap(const size_t size){
|
T** getANewMap(const size_t size){
|
||||||
T **map = new T*[size];
|
T **map = new T*[size];
|
||||||
for (int i = 0; i != size; ++i)
|
for (int i = 0; i != size; ++i)
|
||||||
map[i] = dataAllocator::allocate(getBuckSize());
|
map[i] = getANewBuck();
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
size_t getNewMapSize(const size_t size){
|
size_t getNewMapSize(const size_t size){
|
||||||
@@ -311,5 +311,12 @@ namespace TinySTL{
|
|||||||
--end_;
|
--end_;
|
||||||
dataAllocator::destroy(end_.cur_);
|
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
|
#endif
|
||||||
Reference in New Issue
Block a user