diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -1866,7 +1866,7 @@ size_type __reserve) { if (__reserve > max_size()) - this->__throw_length_error(); + __throw_length_error(); pointer __p; if (__fits_in_sso(__reserve)) { @@ -1890,7 +1890,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) { if (__sz > max_size()) - this->__throw_length_error(); + __throw_length_error(); pointer __p; if (__fits_in_sso(__sz)) { @@ -1973,7 +1973,7 @@ __set_short_size(__sz); } else { if (__sz > max_size()) - this->__throw_length_error(); + __throw_length_error(); size_t __cap = __recommend(__sz); __p = __alloc_traits::allocate(__alloc(), __cap + 1); __set_long_pointer(__p); @@ -2029,7 +2029,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) { if (__n > max_size()) - this->__throw_length_error(); + __throw_length_error(); pointer __p; if (__fits_in_sso(__n)) { @@ -2074,7 +2074,7 @@ { size_type __str_sz = __str.size(); if (__pos > __str_sz) - this->__throw_out_of_range(); + __throw_out_of_range(); __init(__str.data() + __pos, _VSTD::min(__n, __str_sz - __pos)); _VSTD::__debug_db_insert_c(this); } @@ -2087,7 +2087,7 @@ { size_type __str_sz = __str.size(); if (__pos > __str_sz) - this->__throw_out_of_range(); + __throw_out_of_range(); __init(__str.data() + __pos, __str_sz - __pos); _VSTD::__debug_db_insert_c(this); } @@ -2160,7 +2160,7 @@ { size_type __sz = static_cast(_VSTD::distance(__first, __last)); if (__sz > max_size()) - this->__throw_length_error(); + __throw_length_error(); pointer __p; if (__fits_in_sso(__sz)) { @@ -2259,7 +2259,7 @@ { size_type __ms = max_size(); if (__delta_cap > __ms - __old_cap - 1) - this->__throw_length_error(); + __throw_length_error(); pointer __old_p = __get_pointer(); size_type __cap = __old_cap < __ms / 2 - __alignment ? __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) : @@ -2291,7 +2291,7 @@ { size_type __ms = max_size(); if (__delta_cap > __ms - __old_cap) - this->__throw_length_error(); + __throw_length_error(); pointer __old_p = __get_pointer(); size_type __cap = __old_cap < __ms / 2 - __alignment ? __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) : @@ -2523,7 +2523,7 @@ { size_type __sz = __str.size(); if (__pos > __sz) - this->__throw_out_of_range(); + __throw_out_of_range(); return assign(__str.data() + __pos, _VSTD::min(__n, __sz - __pos)); } @@ -2540,7 +2540,7 @@ __self_view __sv = __t; size_type __sz = __sv.size(); if (__pos > __sz) - this->__throw_out_of_range(); + __throw_out_of_range(); return assign(__sv.data() + __pos, _VSTD::min(__n, __sz - __pos)); } @@ -2709,7 +2709,7 @@ { size_type __sz = __str.size(); if (__pos > __sz) - this->__throw_out_of_range(); + __throw_out_of_range(); return append(__str.data() + __pos, _VSTD::min(__n, __sz - __pos)); } @@ -2725,7 +2725,7 @@ __self_view __sv = __t; size_type __sz = __sv.size(); if (__pos > __sz) - this->__throw_out_of_range(); + __throw_out_of_range(); return append(__sv.data() + __pos, _VSTD::min(__n, __sz - __pos)); } @@ -2746,7 +2746,7 @@ _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert received nullptr"); size_type __sz = size(); if (__pos > __sz) - this->__throw_out_of_range(); + __throw_out_of_range(); size_type __cap = capacity(); if (__cap - __sz >= __n) { @@ -2777,7 +2777,7 @@ { size_type __sz = size(); if (__pos > __sz) - this->__throw_out_of_range(); + __throw_out_of_range(); if (__n) { size_type __cap = capacity(); @@ -2883,7 +2883,7 @@ { size_type __str_sz = __str.size(); if (__pos2 > __str_sz) - this->__throw_out_of_range(); + __throw_out_of_range(); return insert(__pos1, __str.data() + __pos2, _VSTD::min(__n, __str_sz - __pos2)); } @@ -2900,7 +2900,7 @@ __self_view __sv = __t; size_type __str_sz = __sv.size(); if (__pos2 > __str_sz) - this->__throw_out_of_range(); + __throw_out_of_range(); return insert(__pos1, __sv.data() + __pos2, _VSTD::min(__n, __str_sz - __pos2)); } @@ -2961,7 +2961,7 @@ _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr"); size_type __sz = size(); if (__pos > __sz) - this->__throw_out_of_range(); + __throw_out_of_range(); __n1 = _VSTD::min(__n1, __sz - __pos); size_type __cap = capacity(); if (__cap - __sz + __n1 >= __n2) @@ -3008,7 +3008,7 @@ { size_type __sz = size(); if (__pos > __sz) - this->__throw_out_of_range(); + __throw_out_of_range(); __n1 = _VSTD::min(__n1, __sz - __pos); size_type __cap = capacity(); value_type* __p; @@ -3042,7 +3042,7 @@ _InputIterator __j1, _InputIterator __j2) { const basic_string __temp(__j1, __j2, __alloc()); - return this->replace(__i1, __i2, __temp); + return replace(__i1, __i2, __temp); } template @@ -3060,7 +3060,7 @@ { size_type __str_sz = __str.size(); if (__pos2 > __str_sz) - this->__throw_out_of_range(); + __throw_out_of_range(); return replace(__pos1, __n1, __str.data() + __pos2, _VSTD::min(__n2, __str_sz - __pos2)); } @@ -3077,7 +3077,7 @@ __self_view __sv = __t; size_type __str_sz = __sv.size(); if (__pos2 > __str_sz) - this->__throw_out_of_range(); + __throw_out_of_range(); return replace(__pos1, __n1, __sv.data() + __pos2, _VSTD::min(__n2, __str_sz - __pos2)); } @@ -3147,7 +3147,8 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n) { - if (__pos > size()) this->__throw_out_of_range(); + if (__pos > size()) + __throw_out_of_range(); if (__n == npos) { __erase_to_end(__pos); } else { @@ -3263,7 +3264,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) { if (__requested_capacity > max_size()) - this->__throw_length_error(); + __throw_length_error(); // Make sure reserve(n) never shrinks. This is technically only required in C++20 // and later (since P0966R1), however we provide consistent behavior in all Standard @@ -3370,7 +3371,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const { if (__n >= size()) - this->__throw_out_of_range(); + __throw_out_of_range(); return (*this)[__n]; } @@ -3379,7 +3380,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) { if (__n >= size()) - this->__throw_out_of_range(); + __throw_out_of_range(); return (*this)[__n]; } @@ -3425,7 +3426,7 @@ { size_type __sz = size(); if (__pos > __sz) - this->__throw_out_of_range(); + __throw_out_of_range(); size_type __rlen = _VSTD::min(__n, __sz - __pos); traits_type::copy(__s, data() + __pos, __rlen); return __rlen; @@ -3869,7 +3870,7 @@ _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr"); size_type __sz = size(); if (__pos1 > __sz || __n2 == npos) - this->__throw_out_of_range(); + __throw_out_of_range(); size_type __rlen = _VSTD::min(__n1, __sz - __pos1); int __r = traits_type::compare(data() + __pos1, __s, _VSTD::min(__rlen, __n2)); if (__r == 0) @@ -3933,7 +3934,7 @@ size_type __pos2, size_type __n2) const { - return compare(__pos1, __n1, __self_view(__str), __pos2, __n2); + return compare(__pos1, __n1, __self_view(__str), __pos2, __n2); } template @@ -4447,16 +4448,16 @@ bool basic_string<_CharT, _Traits, _Allocator>::__dereferenceable(const const_iterator* __i) const { - return this->data() <= _VSTD::__to_address(__i->base()) && - _VSTD::__to_address(__i->base()) < this->data() + this->size(); + return data() <= _VSTD::__to_address(__i->base()) && + _VSTD::__to_address(__i->base()) < data() + size(); } template bool basic_string<_CharT, _Traits, _Allocator>::__decrementable(const const_iterator* __i) const { - return this->data() < _VSTD::__to_address(__i->base()) && - _VSTD::__to_address(__i->base()) <= this->data() + this->size(); + return data() < _VSTD::__to_address(__i->base()) && + _VSTD::__to_address(__i->base()) <= data() + size(); } template @@ -4464,7 +4465,7 @@ basic_string<_CharT, _Traits, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const { const value_type* __p = _VSTD::__to_address(__i->base()) + __n; - return this->data() <= __p && __p <= this->data() + this->size(); + return data() <= __p && __p <= data() + size(); } template @@ -4472,7 +4473,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const { const value_type* __p = _VSTD::__to_address(__i->base()) + __n; - return this->data() <= __p && __p < this->data() + this->size(); + return data() <= __p && __p < data() + size(); } #endif // _LIBCPP_DEBUG_LEVEL == 2