添加operator[]操作的const版本
This commit is contained in:
@@ -71,9 +71,10 @@ namespace TinySTL{
|
||||
void shrink_to_fit();
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
value_type& operator[](const difference_type i){ return *(begin() + i); }
|
||||
value_type& front(){ return *(begin()); }
|
||||
value_type& back(){ return *(end() - 1); }
|
||||
reference operator[](const difference_type i){ return *(begin() + i); }
|
||||
const_reference operator[](const difference_type i)const{ return *(cbegin() + i); }
|
||||
reference front(){ return *(begin()); }
|
||||
reference back(){ return *(end() - 1); }
|
||||
pointer data(){ return start_; }
|
||||
|
||||
//<2F><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صIJ<D8B5><C4B2><EFBFBD>
|
||||
|
||||
Reference in New Issue
Block a user