This commit is contained in:
邹晓航
2014-10-22 19:21:48 +08:00
parent b7fc59cf12
commit 17ed103dfb

View File

@@ -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