diff options
author | Paolo Carlini <pcarlini@unitus.it> | 2003-06-05 00:53:05 +0200 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2003-06-04 22:53:05 +0000 |
commit | 7778fa6e3b21c2cf169f59c86a5284e06f8f0371 (patch) | |
tree | 13f0e29878bc6f9141c1764abd24a93b99d2f6a7 /libstdc++-v3/include/bits/basic_string.h | |
parent | 1072ec3fdc48a1fe16084bdb046077bbb43e1216 (diff) |
basic_string.h (_M_fold, [...]): Constify various variables.
2003-06-04 Paolo Carlini <pcarlini@unitus.it>
* include/bits/basic_string.h (_M_fold, insert(iterator, _CharT),
erase(iterator), erase(iterator, iterator), c_str,
compare(const basic_string&)): Constify various variables.
* include/bits/basic_string.tcc (_S_construct(_InIter, _InIter,
const _Alloc&, input_iterator_tag), _M_destroy, _M_mutate,
_S_create, resize, _M_replace, _M_replace_safe,
append(const basic_string&), append(const basic_string&, size_type,
size_type), append(const _CharT*, size_type), append(size_type,
_CharT), operator+(const _CharT*, const basic_string&),
operator+(_CharT, const basic_string&), replace(iterator, iterator,
size_type, _CharT), find(const _CharT*, size_type, size_type),
find(_CharT, size_type), rfind(const _CharT*, size_type, size_type),
rfind(_CharT, size_type), compare(size_type, size_type,
const basic_string&), compare(size_type, size_type,
const basic_string&, size_type, size_type), compare(const _CharT*),
compare(size_type, size_type, const _CharT*), compare(size_type,
size_type, const _CharT*, size_type)): Likewise.
From-SVN: r67468
Diffstat (limited to 'libstdc++-v3/include/bits/basic_string.h')
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 04847f757b2..6d3cb9b9028 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -283,8 +283,8 @@ namespace std iterator _M_fold(size_type __pos, size_type __off) const { - bool __testoff = __off < this->size() - __pos; - size_type __newoff = __testoff ? __off : this->size() - __pos; + const bool __testoff = __off < this->size() - __pos; + const size_type __newoff = __testoff ? __off : this->size() - __pos; return (_M_ibegin() + __pos + __newoff); } @@ -378,8 +378,8 @@ namespace std iterator end() { - _M_leak(); - return iterator(_M_data() + this->size()); + _M_leak(); + return iterator(_M_data() + this->size()); } const_iterator @@ -550,7 +550,7 @@ namespace std iterator insert(iterator __p, _CharT __c = _CharT()) { - size_type __pos = __p - _M_ibegin(); + const size_type __pos = __p - _M_ibegin(); this->insert(_M_check(__pos), size_type(1), __c); _M_rep()->_M_set_leaked(); return this->_M_ibegin() + __pos; @@ -566,7 +566,7 @@ namespace std iterator erase(iterator __position) { - size_type __i = __position - _M_ibegin(); + const size_type __i = __position - _M_ibegin(); this->replace(__position, __position + 1, _M_data(), _M_data()); _M_rep()->_M_set_leaked(); return _M_ibegin() + __i; @@ -575,10 +575,10 @@ namespace std iterator erase(iterator __first, iterator __last) { - size_type __i = __first - _M_ibegin(); + const size_type __i = __first - _M_ibegin(); this->replace(__first, __last, _M_data(), _M_data()); _M_rep()->_M_set_leaked(); - return _M_ibegin() + __i; + return _M_ibegin() + __i; } basic_string& @@ -716,7 +716,7 @@ namespace std c_str() const { // MT: This assumes concurrent writes are OK. - size_type __n = this->size(); + const size_type __n = this->size(); traits_type::assign(_M_data()[__n], _Rep::_S_terminal); return _M_data(); } @@ -825,9 +825,9 @@ namespace std int compare(const basic_string& __str) const { - size_type __size = this->size(); - size_type __osize = __str.size(); - size_type __len = std::min(__size, __osize); + const size_type __size = this->size(); + const size_type __osize = __str.size(); + const size_type __len = std::min(__size, __osize); int __r = traits_type::compare(_M_data(), __str.data(), __len); if (!__r) |