This commit is contained in:
邹晓航
2014-09-23 14:56:06 +08:00
parent c118f6562e
commit 8904505102

View File

@@ -101,6 +101,7 @@ namespace TinySTL{
vector(const vector& v);
vector(vector&& v);
vector& operator = (const vector& v);
vector& operator = (vector&& v);
~vector(){
destroyAndDeallocateAll();
}
@@ -219,7 +220,7 @@ namespace TinySTL{
start_ = v.start_;
finish_ = v.finish_;
endOfStorage_ = v.endOfStorage_;
v.clear();
v.start_ = v.finish_ = v.endOfStorage_ = 0;
}
template<class T, class Alloc>
vector<T, Alloc>& vector<T, Alloc>::operator = (const vector& v){
@@ -228,6 +229,17 @@ namespace TinySTL{
}
return *this;
}
template<class T, class Alloc>
vector<T, Alloc>& vector<T, Alloc>::operator = (vector&& v){
if (this != &v){
destroyAndDeallocateAll();
start_ = v.start_;
finish_ = v.finish_;
endOfStorage_ = v.endOfStorage_;
v.start_ = v.finish_ = v.endOfStorage_ = 0;
}
return *this;
}
//*************<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>******************************
template<class T, class Alloc>
void vector<T, Alloc>::resize(size_type n, value_type val = value_type()){