2003-11-12 04:09:16 +08:00
|
|
|
// Debugging string implementation -*- C++ -*-
|
|
|
|
|
2020-01-01 19:51:42 +08:00
|
|
|
// Copyright (C) 2003-2020 Free Software Foundation, Inc.
|
2003-11-12 04:09:16 +08:00
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
2009-04-09 23:00:19 +08:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2003-11-12 04:09:16 +08:00
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2009-04-09 23:00:19 +08:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2006-11-30 04:59:22 +08:00
|
|
|
/** @file debug/string
|
|
|
|
* This file is a GNU debug extension to the Standard C++ Library.
|
|
|
|
*/
|
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
#ifndef _GLIBCXX_DEBUG_STRING
|
|
|
|
#define _GLIBCXX_DEBUG_STRING 1
|
|
|
|
|
2016-05-13 22:47:46 +08:00
|
|
|
#pragma GCC system_header
|
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
#include <string>
|
|
|
|
#include <debug/safe_sequence.h>
|
2014-05-07 03:59:44 +08:00
|
|
|
#include <debug/safe_container.h>
|
2003-11-12 04:09:16 +08:00
|
|
|
#include <debug/safe_iterator.h>
|
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
#define _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(_Cond,_File,_Line,_Func) \
|
|
|
|
if (! (_Cond)) \
|
|
|
|
__gnu_debug::_Error_formatter::_S_at(_File, _Line, _Func) \
|
|
|
|
._M_message(#_Cond)._M_error()
|
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
namespace __gnu_debug
|
|
|
|
{
|
2018-07-07 01:02:33 +08:00
|
|
|
/** Checks that __s is non-NULL or __n == 0, and then returns __s. */
|
|
|
|
template<typename _CharT, typename _Integer>
|
|
|
|
inline const _CharT*
|
|
|
|
__check_string(const _CharT* __s,
|
|
|
|
_Integer __n __attribute__((__unused__)),
|
|
|
|
const char* __file __attribute__((__unused__)),
|
|
|
|
unsigned int __line __attribute__((__unused__)),
|
|
|
|
const char* __function __attribute__((__unused__)))
|
|
|
|
{
|
|
|
|
#ifdef _GLIBCXX_DEBUG_PEDANTIC
|
|
|
|
_GLIBCXX_DEBUG_VERIFY_STR_COND_AT(__s != 0 || __n == 0,
|
|
|
|
__file, __line, __function);
|
|
|
|
#endif
|
|
|
|
return __s;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Checks that __s is non-NULL and then returns __s. */
|
|
|
|
template<typename _CharT>
|
|
|
|
inline const _CharT*
|
|
|
|
__check_string(const _CharT* __s,
|
|
|
|
const char* __file __attribute__((__unused__)),
|
|
|
|
unsigned int __line __attribute__((__unused__)),
|
|
|
|
const char* __function __attribute__((__unused__)))
|
|
|
|
{
|
|
|
|
#ifdef _GLIBCXX_DEBUG_PEDANTIC
|
|
|
|
_GLIBCXX_DEBUG_VERIFY_STR_COND_AT(__s != 0,
|
|
|
|
__file, __line, __function);
|
|
|
|
#endif
|
|
|
|
return __s;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define __glibcxx_check_string_n_constructor(_Str, _Size) \
|
|
|
|
__check_string(_Str, _Size, __FILE__, __LINE__, __PRETTY_FUNCTION__)
|
|
|
|
|
|
|
|
#define __glibcxx_check_string_constructor(_Str) \
|
|
|
|
__check_string(_Str, __FILE__, __LINE__, __PRETTY_FUNCTION__)
|
|
|
|
|
|
|
|
/// Class std::basic_string with safety/checking/debug instrumentation.
|
|
|
|
template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
|
|
|
|
typename _Allocator = std::allocator<_CharT> >
|
|
|
|
class basic_string
|
|
|
|
: public __gnu_debug::_Safe_container<
|
|
|
|
basic_string<_CharT, _Traits, _Allocator>,
|
|
|
|
_Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)>,
|
|
|
|
public std::basic_string<_CharT, _Traits, _Allocator>
|
|
|
|
{
|
|
|
|
typedef std::basic_string<_CharT, _Traits, _Allocator> _Base;
|
|
|
|
typedef __gnu_debug::_Safe_container<
|
|
|
|
basic_string, _Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)>
|
2017-05-13 05:19:39 +08:00
|
|
|
_Safe;
|
2003-11-12 04:09:16 +08:00
|
|
|
|
re PR libstdc++/68222 (_Safe_iterator provides operators the wrapped iterator can't actually support)
2018-08-22 François Dumont <fdumont@gcc.gnu.org>
PR libstdc++/68222
* include/debug/safe_iterator.h
(_Safe_iterator<_It, _Sq, _Cat>): Add category template parameter.
(_Safe_iterator<>::_Const_iterator): Remove.
(_Safe_iterator<>::_IsConstant): New.
(_Safe_iterator<>::_OtherIterator): New.
(_Safe_iterator<_It, _Sq, _Cat>::_Safe_iterator<_MutIte>(
const _Safe_iterator<_MutIte, _Sq, _Cat>&)): Add _IsConstant::__value in
__gnu_cxx::__enable_if condition.
(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_to): New.
(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_from_begin): New.
(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_to_end): New.
(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>): New.
(_Safe_iterator<_It, _Sq, _Cat>::operator--()): Move...
(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
::operator--()): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::operator--(int)): Move...
(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
::operator--(int)): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::_M_decrementable()): Move...
(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
::_M_decrementable()): ...here.
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>): New.
(_Safe_iterator<_It, _Sq, _Cat>::operator[](const difference_type&)):
Move...
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
::operator[](const difference_type&)): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::operator+=(const difference_type&)):
Move...
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
::operator+=(const difference_type&)): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::operator+(const difference_type&)):
Move...
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
::operator+(const difference_type&)): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::operator-=(const difference_type&)):
Move...
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
::operator-=(const difference_type&)): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::operator-(const difference_type&)):
Move...
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
::operator-(const difference_type&)): ...here.
(operator<(const _Safe_iterator<>&, const _Safe_iterator<>&)):
Constraint to random access iterators.
(operator<=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
Likewise.
(operator>(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
(operator>=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
Likewise.
(operator-(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
(operator+(const difference_type&, const _Safe_iterator<>&)): Likewise.
(__check_dereferenceable(const _Safe_iterator<>&)): Remove.
(__get_distance): Remove.
(__get_distance_from_begin): Remove.
(__get_distance_to_end): Remove.
(struct __is_safe_random_iterator<_Safe_iterator<>>): Remove partial
specialization.
(__base(const _Safe_iterator<>&, std::input_iterator_tag)): Remove.
(__base(const _Safe_iterator<>&, std::random_access_iterator_tag)): Remove.
(__base(const _Safe_iterator<>&)): Constraint to random access iterator.
* include/debug/safe_iterator.tcc
(_Safe_iterator<>::_M_get_distance_from_begin()): New.
(_Safe_iterator<>::_M_get_distance_to_end()): New.
(_Safe_iterator<>::_M_get_distance_to(const _Safe_iterator<>&)): New.
(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>
::_M_valid_range): New.
* include/debug/safe_local_iterator.h
(_Safe_local_iterator<>::_Const_local_iterator): Remove.
(_Safe_local_iterator<>::_IsConstant): New.
(_Safe_local_iterator<>::_OtherIterator): New.
(_Safe_local_iterator<_It, _Cont>::_Safe_local_iterator<_MutIte, _Cont>(
const _Safe_local_iterator<_MutIte, _Seq>&)): Add _IsConstant::__value
in __gnu_cxx::__enable_if condition. If singular compare base iterator
with _MutIte rather than _It.
(_Safe_local_iterator<>::_S_constant): Make constexpr.
(_Safe_local_iterator<>::_M_get_distance_to): New.
(__check_dereferenceable(const _Safe_local_iterator<>&)): Remove.
(__get_distance(const _Safe_local_iterator<>&,
const _Safe_local_iterator<>&, std::input_iterator_tag)): Remove.
(__valid_range(const _Safe_local_iterator<>&,
const _Safe_local_iterator<>&)): New.
* include/debug/safe_local_iterator.tcc
(_Safe_local_iterator<>::_M_get_distance_to): New.
* include/debug/deque (std::__debug::deque<>): Add
::__gnu_debug::_Safe_iterator<> friend declaration.
* include/debug/forward_list (std::__debug::forward_list<>): Likewise.
* include/debug/list (std::__debug::list<>): Likewise.
* include/debug/map.h (std::__debug::map<>): Likewise.
* include/debug/multimap.h (std::__debug::multimap<>): Likewise.
* include/debug/set.h (std::__debug::set<>): Likewise.
* include/debug/multiset.h (std::__debug::multiset<>): Likewise.
* include/debug/string (std::__debug::basic_string<>): Likewise.
* include/debug/unordered_map (std::__debug::unordered_map<>): Likewise
and add ::__gnu_debug::_Safe_local_iterator<> friend declaration.
(std::__debug::unordered_multimap<>): Likewise.
* include/debug/unordered_set (std::__debug::unordered_set<>): Likewise.
(std::__debug::unordered_multiset<>): Likewise.
* include/debug/formatter.h: Adapt.
* include/debug/helper_functions.h
(__gnu_debug::_Safe_local_iterator<>): Add declaration.
(__get_distance<_Ite>(_Ite, _Ite, std::random_access_iterator_tag):
Pass parameter by copy.
(__get_distance<_Ite>(_Ite, _Ite, std::input_iterator_tag): Likewise.
(__get_distance<_Ite>(_Ite, _Ite): Likewise.
(__valid_range_aux<_Integral>): Pass _Integral by copy.
(__valid_range<_InputIterator>): Pass _InputIterator by copy.
(__valid_range<>(const _Safe_iterator<>&,
const _Safe_iterator<>&, typename _Distance_traits<>::__type&)):
Declare.
(__valid_range(const _Safe_local_iterator<>&,
const _Safe_local_iterator<>&, typename _Distance_traits<>::__type&)):
Declare.
(__valid_range<>(const _Safe_iterator<>&, const _Safe_iterator<>&)):
Declare.
(__valid_range(const _Safe_local_iterator<>&, const _Safe_local_iterator<>&)):
Declare.
(__can_advance): Adapt.
(struct __is_safe_random_iterator<>): Remove.
(struct _SIter_base<>): Remove.
* include/debug/functions.h: Include <bits/stl_iterator.h>.
(__check_dereferenceable): Remove.
(__foreign_iterator_aux4, __foreign_iterator_aux3): Adapt.
(__foreign_iterator_aux2, __foreign_iterator_aux): Adapt.
(__foreign_iterator): Adapt.
* include/debug/stl_iterator.h
(__is_safe_random_iterator<std::reverse_iterator<>>): Remove.
(__base(const std::reverse_iterator<_Safe_iterator<_It, _Sq>)):
Constraint for random access iterators.
(__niter_base): Adapt.
* testsuite/util/testsuite_containers.h:
Include <bits/boost_concept_check.h>.
(iterator_concept_checks<_It, _Mutable, _Category>): New.
(citerator<_Cont>::forward_members::forward_members()): Instantiate
latter for container iterator and const_iterator.
* testsuite/23_containers/list/68222_neg.cc: New.
* testsuite/23_containers/vector/cons/destructible_debug_neg.cc: Adapt
line number.
* testsuite/23_containers/unordered_set/debug/debug_functions.cc:
(test01): Remove.
* testsuite/23_containers/vector/debug/debug_functions.cc (test01):
Remove.
From-SVN: r263786
2018-08-23 02:51:25 +08:00
|
|
|
template<typename _ItT, typename _SeqT, typename _CatT>
|
|
|
|
friend class ::__gnu_debug::_Safe_iterator;
|
|
|
|
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
// type used for positions in insert, erase etc.
|
|
|
|
typedef __gnu_debug::_Safe_iterator<
|
|
|
|
typename _Base::__const_iterator, basic_string> __const_iterator;
|
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
public:
|
|
|
|
// types:
|
|
|
|
typedef _Traits traits_type;
|
|
|
|
typedef typename _Traits::char_type value_type;
|
|
|
|
typedef _Allocator allocator_type;
|
|
|
|
typedef typename _Base::size_type size_type;
|
|
|
|
typedef typename _Base::difference_type difference_type;
|
|
|
|
typedef typename _Base::reference reference;
|
|
|
|
typedef typename _Base::const_reference const_reference;
|
|
|
|
typedef typename _Base::pointer pointer;
|
|
|
|
typedef typename _Base::const_pointer const_pointer;
|
|
|
|
|
|
|
|
typedef __gnu_debug::_Safe_iterator<
|
|
|
|
typename _Base::iterator, basic_string> iterator;
|
|
|
|
typedef __gnu_debug::_Safe_iterator<
|
|
|
|
typename _Base::const_iterator, basic_string> const_iterator;
|
|
|
|
|
|
|
|
typedef std::reverse_iterator<iterator> reverse_iterator;
|
|
|
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
|
|
|
|
|
|
|
using _Base::npos;
|
|
|
|
|
|
|
|
basic_string()
|
|
|
|
_GLIBCXX_NOEXCEPT_IF(std::is_nothrow_default_constructible<_Base>::value)
|
|
|
|
: _Base() { }
|
|
|
|
|
|
|
|
// 21.3.1 construct/copy/destroy:
|
|
|
|
explicit
|
|
|
|
basic_string(const _Allocator& __a) _GLIBCXX_NOEXCEPT
|
|
|
|
: _Base(__a) { }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2014-05-07 03:59:44 +08:00
|
|
|
#if __cplusplus < 201103L
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string(const basic_string& __str)
|
|
|
|
: _Base(__str) { }
|
2014-05-07 03:59:44 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
~basic_string() { }
|
2014-05-07 03:59:44 +08:00
|
|
|
#else
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string(const basic_string&) = default;
|
|
|
|
basic_string(basic_string&&) = default;
|
2014-05-07 03:59:44 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string(std::initializer_list<_CharT> __l,
|
|
|
|
const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__l, __a)
|
|
|
|
{ }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2015-09-11 19:02:14 +08:00
|
|
|
#if _GLIBCXX_USE_CXX11_ABI
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string(const basic_string& __s, const _Allocator& __a)
|
|
|
|
: _Base(__s, __a) { }
|
2015-09-11 19:02:14 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string(basic_string&& __s, const _Allocator& __a)
|
|
|
|
: _Base(std::move(__s), __a) { }
|
2015-09-11 19:02:14 +08:00
|
|
|
#endif
|
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
~basic_string() = default;
|
2015-09-11 19:02:14 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// Provides conversion from a normal-mode string to a debug-mode string
|
|
|
|
basic_string(_Base&& __base) noexcept
|
|
|
|
: _Base(std::move(__base)) { }
|
2014-05-07 03:59:44 +08:00
|
|
|
#endif // C++11
|
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// Provides conversion from a normal-mode string to a debug-mode string
|
|
|
|
basic_string(const _Base& __base)
|
|
|
|
: _Base(__base) { }
|
2014-05-07 03:59:44 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 42. string ctors specify wrong default allocator
|
|
|
|
basic_string(const basic_string& __str, size_type __pos,
|
|
|
|
size_type __n = _Base::npos,
|
|
|
|
const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__str, __pos, __n, __a) { }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string(const _CharT* __s, size_type __n,
|
|
|
|
const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__glibcxx_check_string_n_constructor(__s, __n), __n, __a) { }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string(const _CharT* __s, const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__glibcxx_check_string_constructor(__s), __a)
|
|
|
|
{ this->assign(__s); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string(size_type __n, _CharT __c,
|
2003-11-12 04:09:16 +08:00
|
|
|
const _Allocator& __a = _Allocator())
|
2018-07-07 01:02:33 +08:00
|
|
|
: _Base(__n, __c, __a) { }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
template<typename _InputIterator>
|
|
|
|
basic_string(_InputIterator __begin, _InputIterator __end,
|
|
|
|
const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__gnu_debug::__base(
|
macros.h (__glibcxx_check_valid_range_at): New.
2018-05-08 François Dumont <fdumont@gcc.gnu.org>
* include/debug/macros.h (__glibcxx_check_valid_range_at): New.
* include/debug/functions.h (__check_valid_range): Use latter.
* include/debug/macros.h (__glibcxx_check_valid_constructor_range): New,
use latter.
* include/debug/deque
(deque::deque<_Iter>(_Iter, _Iter, const _Alloc&)): Use latter.
* include/debug/forward_list
(forward_list::forward_list<_Iter>(_Iter, _Iter, const _Alloc&)):
Likewise.
* include/debug/list
(list::list<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
* include/debug/list
(list::list<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
* include/debug/map.h
(map::map<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
(map::map<_Iter>(_Iter, _Iter, const _Compare&, const _Alloc&)):
Likewise.
* include/debug/multimap.h
(multimap::multimap<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
(multimap::multimap<_Iter>(_Iter, _Iter, const _Compare&,
const _Alloc&)): Likewise.
* include/debug/set.h
(set::set<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
(set::set<_Iter>(_Iter, _Iter, const _Compare&, const _Alloc&)):
Likewise.
* include/debug/multiset.h
(multiset::multiset<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
(multiset::multiset<_Iter>(_Iter, _Iter, const _Compare&,
const _Alloc&)): Likewise.
* include/debug/string
(basic_string::basic_string<_Iter>(_Iter, _Iter, const _Alloc&)):
Likewise.
* include/debug/unordered_map
(unordered_map::unordered_map<_Iter>(_Iter, _Iter, const _Alloc&)):
Likewise.
(unordered_multimap::unordered_multimap<_Iter>(_Iter, _Iter,
const _Alloc&)): Likewise.
* include/debug/unordered_set
(unordered_set::unordered_set<_Iter>(_Iter, _Iter, const _Alloc&)):
Likewise.
(unordered_multiset::unordered_multiset<_Iter>(_Iter, _Iter,
const _Alloc&)): Likewise.
* include/debug/vector
(vector::vector<_Iter>(_Iter, _Iter, const _Alloc&)): Use latter.
From-SVN: r260053
2018-05-09 03:46:59 +08:00
|
|
|
__glibcxx_check_valid_constructor_range(__begin, __end)),
|
2018-07-07 01:02:33 +08:00
|
|
|
__gnu_debug::__base(__end), __a) { }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2014-05-07 03:59:44 +08:00
|
|
|
#if __cplusplus < 201103L
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
operator=(const basic_string& __str)
|
|
|
|
{
|
|
|
|
this->_M_safe() = __str;
|
|
|
|
_M_base() = __str;
|
|
|
|
return *this;
|
|
|
|
}
|
2014-05-07 03:59:44 +08:00
|
|
|
#else
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
operator=(const basic_string&) = default;
|
2014-05-07 03:59:44 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
operator=(basic_string&&) = default;
|
2014-05-07 03:59:44 +08:00
|
|
|
#endif
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
operator=(const _CharT* __s)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
_M_base() = __s;
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
operator=(_CharT __c)
|
|
|
|
{
|
|
|
|
_M_base() = __c;
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2012-11-11 01:27:22 +08:00
|
|
|
#if __cplusplus >= 201103L
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
operator=(std::initializer_list<_CharT> __l)
|
|
|
|
{
|
|
|
|
_M_base() = __l;
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2012-11-11 01:27:22 +08:00
|
|
|
#endif // C++11
|
2008-07-22 03:40:39 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// 21.3.2 iterators:
|
|
|
|
iterator
|
|
|
|
begin() // _GLIBCXX_NOEXCEPT
|
|
|
|
{ return iterator(_Base::begin(), this); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
const_iterator
|
|
|
|
begin() const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return const_iterator(_Base::begin(), this); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
iterator
|
|
|
|
end() // _GLIBCXX_NOEXCEPT
|
|
|
|
{ return iterator(_Base::end(), this); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
const_iterator
|
|
|
|
end() const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return const_iterator(_Base::end(), this); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
reverse_iterator
|
|
|
|
rbegin() // _GLIBCXX_NOEXCEPT
|
|
|
|
{ return reverse_iterator(end()); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
const_reverse_iterator
|
|
|
|
rbegin() const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return const_reverse_iterator(end()); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
reverse_iterator
|
|
|
|
rend() // _GLIBCXX_NOEXCEPT
|
|
|
|
{ return reverse_iterator(begin()); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
const_reverse_iterator
|
|
|
|
rend() const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return const_reverse_iterator(begin()); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2012-11-11 01:27:22 +08:00
|
|
|
#if __cplusplus >= 201103L
|
2018-07-07 01:02:33 +08:00
|
|
|
const_iterator
|
|
|
|
cbegin() const noexcept
|
|
|
|
{ return const_iterator(_Base::begin(), this); }
|
2011-05-31 20:50:31 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
const_iterator
|
|
|
|
cend() const noexcept
|
|
|
|
{ return const_iterator(_Base::end(), this); }
|
2011-05-31 20:50:31 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
const_reverse_iterator
|
|
|
|
crbegin() const noexcept
|
|
|
|
{ return const_reverse_iterator(end()); }
|
2011-05-31 20:50:31 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
const_reverse_iterator
|
|
|
|
crend() const noexcept
|
|
|
|
{ return const_reverse_iterator(begin()); }
|
2011-05-31 20:50:31 +08:00
|
|
|
#endif
|
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// 21.3.3 capacity:
|
|
|
|
using _Base::size;
|
|
|
|
using _Base::length;
|
|
|
|
using _Base::max_size;
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
void
|
|
|
|
resize(size_type __n, _CharT __c)
|
|
|
|
{
|
|
|
|
_Base::resize(__n, __c);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
void
|
|
|
|
resize(size_type __n)
|
|
|
|
{ this->resize(__n, _CharT()); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2012-11-11 01:27:22 +08:00
|
|
|
#if __cplusplus >= 201103L
|
2018-07-07 01:02:33 +08:00
|
|
|
void
|
|
|
|
shrink_to_fit() noexcept
|
|
|
|
{
|
|
|
|
if (capacity() > size())
|
|
|
|
{
|
|
|
|
__try
|
|
|
|
{
|
|
|
|
reserve(0);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
}
|
|
|
|
__catch(...)
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
}
|
2010-01-08 21:01:24 +08:00
|
|
|
#endif
|
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
using _Base::capacity;
|
|
|
|
using _Base::reserve;
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
void
|
|
|
|
clear() // _GLIBCXX_NOEXCEPT
|
|
|
|
{
|
|
|
|
_Base::clear();
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
using _Base::empty;
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// 21.3.4 element access:
|
|
|
|
const_reference
|
|
|
|
operator[](size_type __pos) const _GLIBCXX_NOEXCEPT
|
|
|
|
{
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__pos <= this->size(),
|
|
|
|
_M_message(__gnu_debug::__msg_subscript_oob)
|
|
|
|
._M_sequence(*this, "this")
|
|
|
|
._M_integer(__pos, "__pos")
|
|
|
|
._M_integer(this->size(), "size"));
|
|
|
|
return _M_base()[__pos];
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
reference
|
|
|
|
operator[](size_type __pos) // _GLIBCXX_NOEXCEPT
|
|
|
|
{
|
2015-09-11 19:02:14 +08:00
|
|
|
#if __cplusplus < 201103L && defined(_GLIBCXX_DEBUG_PEDANTIC)
|
2018-07-07 01:02:33 +08:00
|
|
|
__glibcxx_check_subscript(__pos);
|
2005-05-24 18:58:22 +08:00
|
|
|
#else
|
2018-07-07 01:02:33 +08:00
|
|
|
// as an extension v3 allows s[s.size()] when s is non-const.
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__pos <= this->size(),
|
|
|
|
_M_message(__gnu_debug::__msg_subscript_oob)
|
|
|
|
._M_sequence(*this, "this")
|
|
|
|
._M_integer(__pos, "__pos")
|
|
|
|
._M_integer(this->size(), "size"));
|
2005-05-24 18:58:22 +08:00
|
|
|
#endif
|
2018-07-07 01:02:33 +08:00
|
|
|
return _M_base()[__pos];
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
using _Base::at;
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2012-11-11 01:27:22 +08:00
|
|
|
#if __cplusplus >= 201103L
|
2018-07-07 01:02:33 +08:00
|
|
|
using _Base::front;
|
|
|
|
using _Base::back;
|
2010-05-31 22:14:42 +08:00
|
|
|
#endif
|
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// 21.3.5 modifiers:
|
|
|
|
basic_string&
|
|
|
|
operator+=(const basic_string& __str)
|
|
|
|
{
|
|
|
|
_M_base() += __str;
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
operator+=(const _CharT* __s)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
_M_base() += __s;
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
operator+=(_CharT __c)
|
|
|
|
{
|
|
|
|
_M_base() += __c;
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2012-11-11 01:27:22 +08:00
|
|
|
#if __cplusplus >= 201103L
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
operator+=(std::initializer_list<_CharT> __l)
|
|
|
|
{
|
|
|
|
_M_base() += __l;
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2012-11-11 01:27:22 +08:00
|
|
|
#endif // C++11
|
2008-07-22 03:40:39 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
append(const basic_string& __str)
|
|
|
|
{
|
|
|
|
_Base::append(__str);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
append(const basic_string& __str, size_type __pos, size_type __n)
|
|
|
|
{
|
|
|
|
_Base::append(__str, __pos, __n);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
basic_string&
|
2018-07-07 01:02:33 +08:00
|
|
|
append(const _CharT* __s, size_type __n)
|
2003-11-12 04:09:16 +08:00
|
|
|
{
|
2018-07-07 01:02:33 +08:00
|
|
|
__glibcxx_check_string_len(__s, __n);
|
|
|
|
_Base::append(__s, __n);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition
to pre-C++11 mode.
* include/debug/functions.h
(__gnu_debug::__valid_range, __gnu_debug::__base): Move...
* include/debug/safe_iterator.h
(__gnu_debug::_Sequence_traits): New.
(__gnu_debug::__get_distance_from_begin): New.
(__gnu_debug::__get_distance_to_end): New.
(__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range
distance information. Add optional check_dereferenceable parameter,
default true.
(__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move
default definition...
(__gnu_debug::__get_distance): New overload for _Safe_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/helper_functions.h: ...here. New.
(__gnu_debug::__unsafe): New helper function to remove safe iterator
layer.
* include/debug/stl_iterator.h: New. Include latter.
* include/bits/stl_iterator.h: Include latter in debug mode.
* include/debug/stl_iterator.tcc: Adapt.
* include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add
overload for _Safe_local_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/safe_local_iterator.tcc: Adapt.
* include/debug/macros.h (__glibcxx_check_valid_range2): New.
(__glibcxx_check_insert_range): Add _Dist parameter.
(__glibcxx_check_insert_range_after): Likewise.
(__glibcxx_check_string, __glibcxx_check_string_len): Implement using
_GLIBCXX_DEBUG_PEDASSERT.
* include/debug/deque (deque<>::assign): Remove iterator debug layer
when possible.
(deque<>::insert): Likewise.
* include/debug/forward_list (__glibcxx_check_valid_fl_range): New.
(forward_list<>::splice_after): Use latter.
(forward_list<>::assign): Remove iterator debug layer when possible.
(forward_list<>::insert_after): Likewise.
(__gnu_debug::_Sequence_traits<>): Partial specialization.
* include/debug/list (list<>::assign): Remove iterator debug layer when
possible.
(list<>::insert): Likewise.
[__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI.
* include/debug/map.h (map<>::insert): Remove iterator debug layer when
possible.
* include/debug/multimap.h (multimap<>::insert): Likewise.
* include/debug/set.h (set<>::insert): Likewise.
* include/debug/multiset.h (multiset<>::insert): Likewise.
* include/debug/string (basic_string<>::append, basic_string<>::assign,
basic_string<>::insert, basic_string<>::replace): Likewise.
* include/debug/unordered_map
(unordered_map<>::insert, unordered_multimap<>::insert): Likewise.
* include/debug/unordered_set
(unordered_set<>::insert, unordered_multiset<>insert): Likewise.
* include/debug/vector
(vector<>::assign, vector<>::insert): Likewise.
* include/Makefile.am: Add new debug headers.
* include/Makefile.in: Regenerate.
From-SVN: r225143
2015-06-30 04:17:56 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
append(const _CharT* __s)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
_Base::append(__s);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition
to pre-C++11 mode.
* include/debug/functions.h
(__gnu_debug::__valid_range, __gnu_debug::__base): Move...
* include/debug/safe_iterator.h
(__gnu_debug::_Sequence_traits): New.
(__gnu_debug::__get_distance_from_begin): New.
(__gnu_debug::__get_distance_to_end): New.
(__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range
distance information. Add optional check_dereferenceable parameter,
default true.
(__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move
default definition...
(__gnu_debug::__get_distance): New overload for _Safe_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/helper_functions.h: ...here. New.
(__gnu_debug::__unsafe): New helper function to remove safe iterator
layer.
* include/debug/stl_iterator.h: New. Include latter.
* include/bits/stl_iterator.h: Include latter in debug mode.
* include/debug/stl_iterator.tcc: Adapt.
* include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add
overload for _Safe_local_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/safe_local_iterator.tcc: Adapt.
* include/debug/macros.h (__glibcxx_check_valid_range2): New.
(__glibcxx_check_insert_range): Add _Dist parameter.
(__glibcxx_check_insert_range_after): Likewise.
(__glibcxx_check_string, __glibcxx_check_string_len): Implement using
_GLIBCXX_DEBUG_PEDASSERT.
* include/debug/deque (deque<>::assign): Remove iterator debug layer
when possible.
(deque<>::insert): Likewise.
* include/debug/forward_list (__glibcxx_check_valid_fl_range): New.
(forward_list<>::splice_after): Use latter.
(forward_list<>::assign): Remove iterator debug layer when possible.
(forward_list<>::insert_after): Likewise.
(__gnu_debug::_Sequence_traits<>): Partial specialization.
* include/debug/list (list<>::assign): Remove iterator debug layer when
possible.
(list<>::insert): Likewise.
[__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI.
* include/debug/map.h (map<>::insert): Remove iterator debug layer when
possible.
* include/debug/multimap.h (multimap<>::insert): Likewise.
* include/debug/set.h (set<>::insert): Likewise.
* include/debug/multiset.h (multiset<>::insert): Likewise.
* include/debug/string (basic_string<>::append, basic_string<>::assign,
basic_string<>::insert, basic_string<>::replace): Likewise.
* include/debug/unordered_map
(unordered_map<>::insert, unordered_multimap<>::insert): Likewise.
* include/debug/unordered_set
(unordered_set<>::insert, unordered_multiset<>insert): Likewise.
* include/debug/vector
(vector<>::assign, vector<>::insert): Likewise.
* include/Makefile.am: Add new debug headers.
* include/Makefile.in: Regenerate.
From-SVN: r225143
2015-06-30 04:17:56 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
append(size_type __n, _CharT __c)
|
|
|
|
{
|
|
|
|
_Base::append(__n, __c);
|
2003-11-12 04:09:16 +08:00
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
template<typename _InputIterator>
|
|
|
|
basic_string&
|
|
|
|
append(_InputIterator __first, _InputIterator __last)
|
|
|
|
{
|
|
|
|
typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
|
|
|
|
__glibcxx_check_valid_range2(__first, __last, __dist);
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
if (__dist.second >= __dp_sign)
|
|
|
|
_Base::append(__gnu_debug::__unsafe(__first),
|
|
|
|
__gnu_debug::__unsafe(__last));
|
|
|
|
else
|
|
|
|
_Base::append(__first, __last);
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2010-01-11 00:15:58 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 7. string clause minor problems
|
|
|
|
void
|
|
|
|
push_back(_CharT __c)
|
|
|
|
{
|
|
|
|
_Base::push_back(__c);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
assign(const basic_string& __x)
|
|
|
|
{
|
|
|
|
_Base::assign(__x);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
basic_string&
|
|
|
|
assign(basic_string&& __x)
|
|
|
|
noexcept(noexcept(std::declval<_Base&>().assign(std::move(__x))))
|
|
|
|
{
|
|
|
|
_Base::assign(std::move(__x));
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
#endif // C++11
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
assign(const basic_string& __str, size_type __pos, size_type __n)
|
|
|
|
{
|
|
|
|
_Base::assign(__str, __pos, __n);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
basic_string&
|
2018-07-07 01:02:33 +08:00
|
|
|
assign(const _CharT* __s, size_type __n)
|
2003-11-12 04:09:16 +08:00
|
|
|
{
|
2018-07-07 01:02:33 +08:00
|
|
|
__glibcxx_check_string_len(__s, __n);
|
|
|
|
_Base::assign(__s, __n);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition
to pre-C++11 mode.
* include/debug/functions.h
(__gnu_debug::__valid_range, __gnu_debug::__base): Move...
* include/debug/safe_iterator.h
(__gnu_debug::_Sequence_traits): New.
(__gnu_debug::__get_distance_from_begin): New.
(__gnu_debug::__get_distance_to_end): New.
(__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range
distance information. Add optional check_dereferenceable parameter,
default true.
(__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move
default definition...
(__gnu_debug::__get_distance): New overload for _Safe_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/helper_functions.h: ...here. New.
(__gnu_debug::__unsafe): New helper function to remove safe iterator
layer.
* include/debug/stl_iterator.h: New. Include latter.
* include/bits/stl_iterator.h: Include latter in debug mode.
* include/debug/stl_iterator.tcc: Adapt.
* include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add
overload for _Safe_local_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/safe_local_iterator.tcc: Adapt.
* include/debug/macros.h (__glibcxx_check_valid_range2): New.
(__glibcxx_check_insert_range): Add _Dist parameter.
(__glibcxx_check_insert_range_after): Likewise.
(__glibcxx_check_string, __glibcxx_check_string_len): Implement using
_GLIBCXX_DEBUG_PEDASSERT.
* include/debug/deque (deque<>::assign): Remove iterator debug layer
when possible.
(deque<>::insert): Likewise.
* include/debug/forward_list (__glibcxx_check_valid_fl_range): New.
(forward_list<>::splice_after): Use latter.
(forward_list<>::assign): Remove iterator debug layer when possible.
(forward_list<>::insert_after): Likewise.
(__gnu_debug::_Sequence_traits<>): Partial specialization.
* include/debug/list (list<>::assign): Remove iterator debug layer when
possible.
(list<>::insert): Likewise.
[__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI.
* include/debug/map.h (map<>::insert): Remove iterator debug layer when
possible.
* include/debug/multimap.h (multimap<>::insert): Likewise.
* include/debug/set.h (set<>::insert): Likewise.
* include/debug/multiset.h (multiset<>::insert): Likewise.
* include/debug/string (basic_string<>::append, basic_string<>::assign,
basic_string<>::insert, basic_string<>::replace): Likewise.
* include/debug/unordered_map
(unordered_map<>::insert, unordered_multimap<>::insert): Likewise.
* include/debug/unordered_set
(unordered_set<>::insert, unordered_multiset<>insert): Likewise.
* include/debug/vector
(vector<>::assign, vector<>::insert): Likewise.
* include/Makefile.am: Add new debug headers.
* include/Makefile.in: Regenerate.
From-SVN: r225143
2015-06-30 04:17:56 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
assign(const _CharT* __s)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
_Base::assign(__s);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition
to pre-C++11 mode.
* include/debug/functions.h
(__gnu_debug::__valid_range, __gnu_debug::__base): Move...
* include/debug/safe_iterator.h
(__gnu_debug::_Sequence_traits): New.
(__gnu_debug::__get_distance_from_begin): New.
(__gnu_debug::__get_distance_to_end): New.
(__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range
distance information. Add optional check_dereferenceable parameter,
default true.
(__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move
default definition...
(__gnu_debug::__get_distance): New overload for _Safe_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/helper_functions.h: ...here. New.
(__gnu_debug::__unsafe): New helper function to remove safe iterator
layer.
* include/debug/stl_iterator.h: New. Include latter.
* include/bits/stl_iterator.h: Include latter in debug mode.
* include/debug/stl_iterator.tcc: Adapt.
* include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add
overload for _Safe_local_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/safe_local_iterator.tcc: Adapt.
* include/debug/macros.h (__glibcxx_check_valid_range2): New.
(__glibcxx_check_insert_range): Add _Dist parameter.
(__glibcxx_check_insert_range_after): Likewise.
(__glibcxx_check_string, __glibcxx_check_string_len): Implement using
_GLIBCXX_DEBUG_PEDASSERT.
* include/debug/deque (deque<>::assign): Remove iterator debug layer
when possible.
(deque<>::insert): Likewise.
* include/debug/forward_list (__glibcxx_check_valid_fl_range): New.
(forward_list<>::splice_after): Use latter.
(forward_list<>::assign): Remove iterator debug layer when possible.
(forward_list<>::insert_after): Likewise.
(__gnu_debug::_Sequence_traits<>): Partial specialization.
* include/debug/list (list<>::assign): Remove iterator debug layer when
possible.
(list<>::insert): Likewise.
[__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI.
* include/debug/map.h (map<>::insert): Remove iterator debug layer when
possible.
* include/debug/multimap.h (multimap<>::insert): Likewise.
* include/debug/set.h (set<>::insert): Likewise.
* include/debug/multiset.h (multiset<>::insert): Likewise.
* include/debug/string (basic_string<>::append, basic_string<>::assign,
basic_string<>::insert, basic_string<>::replace): Likewise.
* include/debug/unordered_map
(unordered_map<>::insert, unordered_multimap<>::insert): Likewise.
* include/debug/unordered_set
(unordered_set<>::insert, unordered_multiset<>insert): Likewise.
* include/debug/vector
(vector<>::assign, vector<>::insert): Likewise.
* include/Makefile.am: Add new debug headers.
* include/Makefile.in: Regenerate.
From-SVN: r225143
2015-06-30 04:17:56 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
assign(size_type __n, _CharT __c)
|
|
|
|
{
|
|
|
|
_Base::assign(__n, __c);
|
2003-11-12 04:09:16 +08:00
|
|
|
this->_M_invalidate_all();
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
return *this;
|
2003-11-12 04:09:16 +08:00
|
|
|
}
|
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
template<typename _InputIterator>
|
|
|
|
basic_string&
|
|
|
|
assign(_InputIterator __first, _InputIterator __last)
|
|
|
|
{
|
|
|
|
typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
|
|
|
|
__glibcxx_check_valid_range2(__first, __last, __dist);
|
2008-07-22 03:40:39 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
if (__dist.second >= __dp_sign)
|
|
|
|
_Base::assign(__gnu_debug::__unsafe(__first),
|
|
|
|
__gnu_debug::__unsafe(__last));
|
|
|
|
else
|
|
|
|
_Base::assign(__first, __last);
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
basic_string&
|
|
|
|
assign(std::initializer_list<_CharT> __l)
|
|
|
|
{
|
|
|
|
_Base::assign(__l);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
#endif // C++11
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
insert(size_type __pos1, const basic_string& __str)
|
|
|
|
{
|
|
|
|
_Base::insert(__pos1, __str);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
insert(size_type __pos1, const basic_string& __str,
|
|
|
|
size_type __pos2, size_type __n)
|
|
|
|
{
|
|
|
|
_Base::insert(__pos1, __str, __pos2, __n);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
insert(size_type __pos, const _CharT* __s, size_type __n)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
_Base::insert(__pos, __s, __n);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
insert(size_type __pos, const _CharT* __s)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
_Base::insert(__pos, __s);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
basic_string&
|
|
|
|
insert(size_type __pos, size_type __n, _CharT __c)
|
|
|
|
{
|
|
|
|
_Base::insert(__pos, __n, __c);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
PR libstdc++/83328 add correct basic_string::insert for initializer_list
The SSO basic_string has a non-standard insert(iterator, initializer_list)
overload, from a C++0x draft. This adds the correct overload, while also
preserving the old one so that the old symbol is still exported from the
library.
The COW basic_string doesn't have any of the C++11 changes to the insert
overloads (they all still have non-const iterator parameters and the
ones that should return an iterator still return void). This doesn't
make any change to the COW string.
PR libstdc++/83328
* acinclude.m4 (libtool_VERSION): Bump to 6:26:0.
* config/abi/pre/gnu.ver: Add GLIBCXX_3.4.26 and export new symbol.
* configure: Regenerate.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::insert(const_iterator, initializer_list<C>)): Add.
[_GLIBCXX_USE_CXX11_ABI && !_GLIBCXX_DEFINING_STRING_INSTANTIATIONS]
(basic_string::insert(iterator, initializer_list<C>)): Suppress
definition.
* include/debug/string (basic_string::insert(iterator, C)): Change
first parameter to const_iterator.
(basic_string::insert(iterator, size_type, C)): Likewise. Change
return type to iterator.
(basic_string::insert(iterator, InputIterator, InputIterator)):
Likewise.
(basic_string::insert(iterator, initializer_list<C>)): Change first
parameter to const_iterator and return type to iterator.
* src/c++11/string-inst.cc: Extend comment.
* testsuite/21_strings/basic_string/modifiers/insert/char/83328.cc:
New.
* testsuite/21_strings/basic_string/modifiers/insert/wchar_t/83328.cc:
New.
* testsuite/util/testsuite_abi.cc: Add new symbol version.
From-SVN: r261866
2018-06-22 06:01:25 +08:00
|
|
|
iterator
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
insert(__const_iterator __p, _CharT __c)
|
2003-11-12 04:09:16 +08:00
|
|
|
{
|
2018-07-07 01:02:33 +08:00
|
|
|
__glibcxx_check_insert(__p);
|
|
|
|
typename _Base::iterator __res = _Base::insert(__p.base(), __c);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return iterator(__res, this);
|
|
|
|
}
|
stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition
to pre-C++11 mode.
* include/debug/functions.h
(__gnu_debug::__valid_range, __gnu_debug::__base): Move...
* include/debug/safe_iterator.h
(__gnu_debug::_Sequence_traits): New.
(__gnu_debug::__get_distance_from_begin): New.
(__gnu_debug::__get_distance_to_end): New.
(__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range
distance information. Add optional check_dereferenceable parameter,
default true.
(__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move
default definition...
(__gnu_debug::__get_distance): New overload for _Safe_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/helper_functions.h: ...here. New.
(__gnu_debug::__unsafe): New helper function to remove safe iterator
layer.
* include/debug/stl_iterator.h: New. Include latter.
* include/bits/stl_iterator.h: Include latter in debug mode.
* include/debug/stl_iterator.tcc: Adapt.
* include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add
overload for _Safe_local_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/safe_local_iterator.tcc: Adapt.
* include/debug/macros.h (__glibcxx_check_valid_range2): New.
(__glibcxx_check_insert_range): Add _Dist parameter.
(__glibcxx_check_insert_range_after): Likewise.
(__glibcxx_check_string, __glibcxx_check_string_len): Implement using
_GLIBCXX_DEBUG_PEDASSERT.
* include/debug/deque (deque<>::assign): Remove iterator debug layer
when possible.
(deque<>::insert): Likewise.
* include/debug/forward_list (__glibcxx_check_valid_fl_range): New.
(forward_list<>::splice_after): Use latter.
(forward_list<>::assign): Remove iterator debug layer when possible.
(forward_list<>::insert_after): Likewise.
(__gnu_debug::_Sequence_traits<>): Partial specialization.
* include/debug/list (list<>::assign): Remove iterator debug layer when
possible.
(list<>::insert): Likewise.
[__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI.
* include/debug/map.h (map<>::insert): Remove iterator debug layer when
possible.
* include/debug/multimap.h (multimap<>::insert): Likewise.
* include/debug/set.h (set<>::insert): Likewise.
* include/debug/multiset.h (multiset<>::insert): Likewise.
* include/debug/string (basic_string<>::append, basic_string<>::assign,
basic_string<>::insert, basic_string<>::replace): Likewise.
* include/debug/unordered_map
(unordered_map<>::insert, unordered_multimap<>::insert): Likewise.
* include/debug/unordered_set
(unordered_set<>::insert, unordered_multiset<>insert): Likewise.
* include/debug/vector
(vector<>::assign, vector<>::insert): Likewise.
* include/Makefile.am: Add new debug headers.
* include/Makefile.in: Regenerate.
From-SVN: r225143
2015-06-30 04:17:56 +08:00
|
|
|
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
#if __cplusplus >= 201103L
|
2018-07-07 01:02:33 +08:00
|
|
|
iterator
|
|
|
|
insert(const_iterator __p, size_type __n, _CharT __c)
|
|
|
|
{
|
|
|
|
__glibcxx_check_insert(__p);
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
#if _GLIBCXX_USE_CXX11_ABI
|
2018-07-07 01:02:33 +08:00
|
|
|
typename _Base::iterator __res = _Base::insert(__p.base(), __n, __c);
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
#else
|
|
|
|
const size_type __offset = __p.base() - _Base::cbegin();
|
|
|
|
_Base::insert(_Base::begin() + __offset, __n, __c);
|
|
|
|
typename _Base::iterator __res = _Base::begin() + __offset;
|
|
|
|
#endif
|
2003-11-12 04:09:16 +08:00
|
|
|
this->_M_invalidate_all();
|
PR libstdc++/83328 add correct basic_string::insert for initializer_list
The SSO basic_string has a non-standard insert(iterator, initializer_list)
overload, from a C++0x draft. This adds the correct overload, while also
preserving the old one so that the old symbol is still exported from the
library.
The COW basic_string doesn't have any of the C++11 changes to the insert
overloads (they all still have non-const iterator parameters and the
ones that should return an iterator still return void). This doesn't
make any change to the COW string.
PR libstdc++/83328
* acinclude.m4 (libtool_VERSION): Bump to 6:26:0.
* config/abi/pre/gnu.ver: Add GLIBCXX_3.4.26 and export new symbol.
* configure: Regenerate.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::insert(const_iterator, initializer_list<C>)): Add.
[_GLIBCXX_USE_CXX11_ABI && !_GLIBCXX_DEFINING_STRING_INSTANTIATIONS]
(basic_string::insert(iterator, initializer_list<C>)): Suppress
definition.
* include/debug/string (basic_string::insert(iterator, C)): Change
first parameter to const_iterator.
(basic_string::insert(iterator, size_type, C)): Likewise. Change
return type to iterator.
(basic_string::insert(iterator, InputIterator, InputIterator)):
Likewise.
(basic_string::insert(iterator, initializer_list<C>)): Change first
parameter to const_iterator and return type to iterator.
* src/c++11/string-inst.cc: Extend comment.
* testsuite/21_strings/basic_string/modifiers/insert/char/83328.cc:
New.
* testsuite/21_strings/basic_string/modifiers/insert/wchar_t/83328.cc:
New.
* testsuite/util/testsuite_abi.cc: Add new symbol version.
From-SVN: r261866
2018-06-22 06:01:25 +08:00
|
|
|
return iterator(__res, this);
|
2003-11-12 04:09:16 +08:00
|
|
|
}
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
#else
|
|
|
|
void
|
|
|
|
insert(iterator __p, size_type __n, _CharT __c)
|
|
|
|
{
|
|
|
|
__glibcxx_check_insert(__p);
|
|
|
|
_Base::insert(__p.base(), __n, __c);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
}
|
|
|
|
#endif
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
template<typename _InputIterator>
|
|
|
|
iterator
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
insert(__const_iterator __p,
|
2018-07-07 01:02:33 +08:00
|
|
|
_InputIterator __first, _InputIterator __last)
|
|
|
|
{
|
|
|
|
typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
|
|
|
|
__glibcxx_check_insert_range(__p, __first, __last, __dist);
|
|
|
|
|
|
|
|
typename _Base::iterator __res;
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
#if _GLIBCXX_USE_CXX11_ABI
|
2018-07-07 01:02:33 +08:00
|
|
|
if (__dist.second >= __dp_sign)
|
|
|
|
__res = _Base::insert(__p.base(), __gnu_debug::__unsafe(__first),
|
|
|
|
__gnu_debug::__unsafe(__last));
|
|
|
|
else
|
|
|
|
__res = _Base::insert(__p.base(), __first, __last);
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
#else
|
2018-08-23 19:21:17 +08:00
|
|
|
const size_type __offset = __p.base() - _Base::begin();
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
_Base::insert(__p.base(), __first, __last);
|
|
|
|
__res = _Base::begin() + __offset;
|
|
|
|
#endif
|
2018-07-07 01:02:33 +08:00
|
|
|
this->_M_invalidate_all();
|
|
|
|
return iterator(__res, this);
|
|
|
|
}
|
|
|
|
|
2012-11-11 01:27:22 +08:00
|
|
|
#if __cplusplus >= 201103L
|
2018-07-07 01:02:33 +08:00
|
|
|
iterator
|
|
|
|
insert(const_iterator __p, std::initializer_list<_CharT> __l)
|
|
|
|
{
|
|
|
|
__glibcxx_check_insert(__p);
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
#if _GLIBCXX_USE_CXX11_ABI
|
2018-07-07 01:02:33 +08:00
|
|
|
const auto __res = _Base::insert(__p.base(), __l);
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
#else
|
|
|
|
const size_type __offset = __p.base() - _Base::cbegin();
|
|
|
|
_Base::insert(_Base::begin() + __offset, __l);
|
|
|
|
auto __res = _Base::begin() + __offset;
|
|
|
|
#endif
|
2018-07-07 01:02:33 +08:00
|
|
|
this->_M_invalidate_all();
|
|
|
|
return iterator(__res, this);
|
|
|
|
}
|
2012-11-11 01:27:22 +08:00
|
|
|
#endif // C++11
|
2008-07-22 03:40:39 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
erase(size_type __pos = 0, size_type __n = _Base::npos)
|
|
|
|
{
|
|
|
|
_Base::erase(__pos, __n);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
iterator
|
|
|
|
erase(iterator __position)
|
|
|
|
{
|
|
|
|
__glibcxx_check_erase(__position);
|
|
|
|
typename _Base::iterator __res = _Base::erase(__position.base());
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return iterator(__res, this);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
iterator
|
|
|
|
erase(iterator __first, iterator __last)
|
|
|
|
{
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 151. can't currently clear() empty container
|
|
|
|
__glibcxx_check_erase_range(__first, __last);
|
|
|
|
typename _Base::iterator __res = _Base::erase(__first.base(),
|
|
|
|
__last.base());
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return iterator(__res, this);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2012-11-11 01:27:22 +08:00
|
|
|
#if __cplusplus >= 201103L
|
2018-07-07 01:02:33 +08:00
|
|
|
void
|
|
|
|
pop_back() // noexcept
|
|
|
|
{
|
|
|
|
__glibcxx_check_nonempty();
|
|
|
|
_Base::pop_back();
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
}
|
2012-11-11 01:27:22 +08:00
|
|
|
#endif // C++11
|
2011-11-07 08:06:23 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
replace(size_type __pos1, size_type __n1, const basic_string& __str)
|
|
|
|
{
|
|
|
|
_Base::replace(__pos1, __n1, __str);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
replace(size_type __pos1, size_type __n1, const basic_string& __str,
|
|
|
|
size_type __pos2, size_type __n2)
|
|
|
|
{
|
|
|
|
_Base::replace(__pos1, __n1, __str, __pos2, __n2);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
replace(size_type __pos, size_type __n1, const _CharT* __s,
|
|
|
|
size_type __n2)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string_len(__s, __n2);
|
|
|
|
_Base::replace(__pos, __n1, __s, __n2);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
replace(size_type __pos, size_type __n1, const _CharT* __s)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
_Base::replace(__pos, __n1, __s);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
|
|
|
replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
|
|
|
|
{
|
|
|
|
_Base::replace(__pos, __n1, __n2, __c);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
basic_string&
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
replace(__const_iterator __i1, __const_iterator __i2,
|
|
|
|
const basic_string& __str)
|
2003-11-12 04:09:16 +08:00
|
|
|
{
|
|
|
|
__glibcxx_check_erase_range(__i1, __i2);
|
2018-07-07 01:02:33 +08:00
|
|
|
_Base::replace(__i1.base(), __i2.base(), __str);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition
to pre-C++11 mode.
* include/debug/functions.h
(__gnu_debug::__valid_range, __gnu_debug::__base): Move...
* include/debug/safe_iterator.h
(__gnu_debug::_Sequence_traits): New.
(__gnu_debug::__get_distance_from_begin): New.
(__gnu_debug::__get_distance_to_end): New.
(__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range
distance information. Add optional check_dereferenceable parameter,
default true.
(__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move
default definition...
(__gnu_debug::__get_distance): New overload for _Safe_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/helper_functions.h: ...here. New.
(__gnu_debug::__unsafe): New helper function to remove safe iterator
layer.
* include/debug/stl_iterator.h: New. Include latter.
* include/bits/stl_iterator.h: Include latter in debug mode.
* include/debug/stl_iterator.tcc: Adapt.
* include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add
overload for _Safe_local_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/safe_local_iterator.tcc: Adapt.
* include/debug/macros.h (__glibcxx_check_valid_range2): New.
(__glibcxx_check_insert_range): Add _Dist parameter.
(__glibcxx_check_insert_range_after): Likewise.
(__glibcxx_check_string, __glibcxx_check_string_len): Implement using
_GLIBCXX_DEBUG_PEDASSERT.
* include/debug/deque (deque<>::assign): Remove iterator debug layer
when possible.
(deque<>::insert): Likewise.
* include/debug/forward_list (__glibcxx_check_valid_fl_range): New.
(forward_list<>::splice_after): Use latter.
(forward_list<>::assign): Remove iterator debug layer when possible.
(forward_list<>::insert_after): Likewise.
(__gnu_debug::_Sequence_traits<>): Partial specialization.
* include/debug/list (list<>::assign): Remove iterator debug layer when
possible.
(list<>::insert): Likewise.
[__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI.
* include/debug/map.h (map<>::insert): Remove iterator debug layer when
possible.
* include/debug/multimap.h (multimap<>::insert): Likewise.
* include/debug/set.h (set<>::insert): Likewise.
* include/debug/multiset.h (multiset<>::insert): Likewise.
* include/debug/string (basic_string<>::append, basic_string<>::assign,
basic_string<>::insert, basic_string<>::replace): Likewise.
* include/debug/unordered_map
(unordered_map<>::insert, unordered_multimap<>::insert): Likewise.
* include/debug/unordered_set
(unordered_set<>::insert, unordered_multiset<>insert): Likewise.
* include/debug/vector
(vector<>::assign, vector<>::insert): Likewise.
* include/Makefile.am: Add new debug headers.
* include/Makefile.in: Regenerate.
From-SVN: r225143
2015-06-30 04:17:56 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
replace(__const_iterator __i1, __const_iterator __i2,
|
|
|
|
const _CharT* __s, size_type __n)
|
2018-07-07 01:02:33 +08:00
|
|
|
{
|
|
|
|
__glibcxx_check_erase_range(__i1, __i2);
|
|
|
|
__glibcxx_check_string_len(__s, __n);
|
|
|
|
_Base::replace(__i1.base(), __i2.base(), __s, __n);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition
to pre-C++11 mode.
* include/debug/functions.h
(__gnu_debug::__valid_range, __gnu_debug::__base): Move...
* include/debug/safe_iterator.h
(__gnu_debug::_Sequence_traits): New.
(__gnu_debug::__get_distance_from_begin): New.
(__gnu_debug::__get_distance_to_end): New.
(__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range
distance information. Add optional check_dereferenceable parameter,
default true.
(__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move
default definition...
(__gnu_debug::__get_distance): New overload for _Safe_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/helper_functions.h: ...here. New.
(__gnu_debug::__unsafe): New helper function to remove safe iterator
layer.
* include/debug/stl_iterator.h: New. Include latter.
* include/bits/stl_iterator.h: Include latter in debug mode.
* include/debug/stl_iterator.tcc: Adapt.
* include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add
overload for _Safe_local_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/safe_local_iterator.tcc: Adapt.
* include/debug/macros.h (__glibcxx_check_valid_range2): New.
(__glibcxx_check_insert_range): Add _Dist parameter.
(__glibcxx_check_insert_range_after): Likewise.
(__glibcxx_check_string, __glibcxx_check_string_len): Implement using
_GLIBCXX_DEBUG_PEDASSERT.
* include/debug/deque (deque<>::assign): Remove iterator debug layer
when possible.
(deque<>::insert): Likewise.
* include/debug/forward_list (__glibcxx_check_valid_fl_range): New.
(forward_list<>::splice_after): Use latter.
(forward_list<>::assign): Remove iterator debug layer when possible.
(forward_list<>::insert_after): Likewise.
(__gnu_debug::_Sequence_traits<>): Partial specialization.
* include/debug/list (list<>::assign): Remove iterator debug layer when
possible.
(list<>::insert): Likewise.
[__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI.
* include/debug/map.h (map<>::insert): Remove iterator debug layer when
possible.
* include/debug/multimap.h (multimap<>::insert): Likewise.
* include/debug/set.h (set<>::insert): Likewise.
* include/debug/multiset.h (multiset<>::insert): Likewise.
* include/debug/string (basic_string<>::append, basic_string<>::assign,
basic_string<>::insert, basic_string<>::replace): Likewise.
* include/debug/unordered_map
(unordered_map<>::insert, unordered_multimap<>::insert): Likewise.
* include/debug/unordered_set
(unordered_set<>::insert, unordered_multiset<>insert): Likewise.
* include/debug/vector
(vector<>::assign, vector<>::insert): Likewise.
* include/Makefile.am: Add new debug headers.
* include/Makefile.in: Regenerate.
From-SVN: r225143
2015-06-30 04:17:56 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
replace(__const_iterator __i1, __const_iterator __i2,
|
|
|
|
const _CharT* __s)
|
2018-07-07 01:02:33 +08:00
|
|
|
{
|
|
|
|
__glibcxx_check_erase_range(__i1, __i2);
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
_Base::replace(__i1.base(), __i2.base(), __s);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition
to pre-C++11 mode.
* include/debug/functions.h
(__gnu_debug::__valid_range, __gnu_debug::__base): Move...
* include/debug/safe_iterator.h
(__gnu_debug::_Sequence_traits): New.
(__gnu_debug::__get_distance_from_begin): New.
(__gnu_debug::__get_distance_to_end): New.
(__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range
distance information. Add optional check_dereferenceable parameter,
default true.
(__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move
default definition...
(__gnu_debug::__get_distance): New overload for _Safe_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/helper_functions.h: ...here. New.
(__gnu_debug::__unsafe): New helper function to remove safe iterator
layer.
* include/debug/stl_iterator.h: New. Include latter.
* include/bits/stl_iterator.h: Include latter in debug mode.
* include/debug/stl_iterator.tcc: Adapt.
* include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add
overload for _Safe_local_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/safe_local_iterator.tcc: Adapt.
* include/debug/macros.h (__glibcxx_check_valid_range2): New.
(__glibcxx_check_insert_range): Add _Dist parameter.
(__glibcxx_check_insert_range_after): Likewise.
(__glibcxx_check_string, __glibcxx_check_string_len): Implement using
_GLIBCXX_DEBUG_PEDASSERT.
* include/debug/deque (deque<>::assign): Remove iterator debug layer
when possible.
(deque<>::insert): Likewise.
* include/debug/forward_list (__glibcxx_check_valid_fl_range): New.
(forward_list<>::splice_after): Use latter.
(forward_list<>::assign): Remove iterator debug layer when possible.
(forward_list<>::insert_after): Likewise.
(__gnu_debug::_Sequence_traits<>): Partial specialization.
* include/debug/list (list<>::assign): Remove iterator debug layer when
possible.
(list<>::insert): Likewise.
[__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI.
* include/debug/map.h (map<>::insert): Remove iterator debug layer when
possible.
* include/debug/multimap.h (multimap<>::insert): Likewise.
* include/debug/set.h (set<>::insert): Likewise.
* include/debug/multiset.h (multiset<>::insert): Likewise.
* include/debug/string (basic_string<>::append, basic_string<>::assign,
basic_string<>::insert, basic_string<>::replace): Likewise.
* include/debug/unordered_map
(unordered_map<>::insert, unordered_multimap<>::insert): Likewise.
* include/debug/unordered_set
(unordered_set<>::insert, unordered_multiset<>insert): Likewise.
* include/debug/vector
(vector<>::assign, vector<>::insert): Likewise.
* include/Makefile.am: Add new debug headers.
* include/Makefile.in: Regenerate.
From-SVN: r225143
2015-06-30 04:17:56 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string&
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
replace(__const_iterator __i1, __const_iterator __i2,
|
|
|
|
size_type __n, _CharT __c)
|
2018-07-07 01:02:33 +08:00
|
|
|
{
|
|
|
|
__glibcxx_check_erase_range(__i1, __i2);
|
|
|
|
_Base::replace(__i1.base(), __i2.base(), __n, __c);
|
2003-11-12 04:09:16 +08:00
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
template<typename _InputIterator>
|
|
|
|
basic_string&
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
replace(__const_iterator __i1, __const_iterator __i2,
|
2018-07-07 01:02:33 +08:00
|
|
|
_InputIterator __j1, _InputIterator __j2)
|
|
|
|
{
|
|
|
|
__glibcxx_check_erase_range(__i1, __i2);
|
|
|
|
|
|
|
|
typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
|
|
|
|
__glibcxx_check_valid_range2(__j1, __j2, __dist);
|
|
|
|
|
|
|
|
if (__dist.second >= __dp_sign)
|
|
|
|
_Base::replace(__i1.base(), __i2.base(),
|
|
|
|
__gnu_debug::__unsafe(__j1),
|
|
|
|
__gnu_debug::__unsafe(__j2));
|
|
|
|
else
|
|
|
|
_Base::replace(__i1.base(), __i2.base(), __j1, __j2);
|
|
|
|
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2012-11-11 01:27:22 +08:00
|
|
|
#if __cplusplus >= 201103L
|
Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.
From-SVN: r263808
2018-08-23 18:51:52 +08:00
|
|
|
basic_string&
|
|
|
|
replace(__const_iterator __i1, __const_iterator __i2,
|
|
|
|
std::initializer_list<_CharT> __l)
|
2008-07-22 03:40:39 +08:00
|
|
|
{
|
|
|
|
__glibcxx_check_erase_range(__i1, __i2);
|
|
|
|
_Base::replace(__i1.base(), __i2.base(), __l);
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return *this;
|
|
|
|
}
|
2012-11-11 01:27:22 +08:00
|
|
|
#endif // C++11
|
2008-07-22 03:40:39 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
copy(_CharT* __s, size_type __n, size_type __pos = 0) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string_len(__s, __n);
|
|
|
|
return _Base::copy(__s, __n, __pos);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
void
|
|
|
|
swap(basic_string& __x)
|
|
|
|
_GLIBCXX_NOEXCEPT_IF(std::__is_nothrow_swappable<_Base>::value)
|
|
|
|
{
|
|
|
|
_Safe::_M_swap(__x);
|
|
|
|
_Base::swap(__x);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// 21.3.6 string operations:
|
|
|
|
const _CharT*
|
|
|
|
c_str() const _GLIBCXX_NOEXCEPT
|
|
|
|
{
|
|
|
|
const _CharT* __res = _Base::c_str();
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return __res;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
const _CharT*
|
|
|
|
data() const _GLIBCXX_NOEXCEPT
|
|
|
|
{
|
|
|
|
const _CharT* __res = _Base::data();
|
|
|
|
this->_M_invalidate_all();
|
|
|
|
return __res;
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
using _Base::get_allocator;
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find(const basic_string& __str, size_type __pos = 0) const
|
|
|
|
_GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::find(__str, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find(const _CharT* __s, size_type __pos, size_type __n) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::find(__s, __pos, __n);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find(const _CharT* __s, size_type __pos = 0) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::find(__s, __pos);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::find(__c, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
rfind(const basic_string& __str, size_type __pos = _Base::npos) const
|
|
|
|
_GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::rfind(__str, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
rfind(const _CharT* __s, size_type __pos, size_type __n) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string_len(__s, __n);
|
|
|
|
return _Base::rfind(__s, __pos, __n);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
rfind(const _CharT* __s, size_type __pos = _Base::npos) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::rfind(__s, __pos);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
rfind(_CharT __c, size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::rfind(__c, __pos); }
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_first_of(const basic_string& __str, size_type __pos = 0) const
|
|
|
|
_GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::find_first_of(__str, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::find_first_of(__s, __pos, __n);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_first_of(const _CharT* __s, size_type __pos = 0) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::find_first_of(__s, __pos);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::find_first_of(__c, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_last_of(const basic_string& __str,
|
|
|
|
size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::find_last_of(__str, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::find_last_of(__s, __pos, __n);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_last_of(const _CharT* __s, size_type __pos = _Base::npos) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::find_last_of(__s, __pos);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_last_of(_CharT __c, size_type __pos = _Base::npos) const
|
|
|
|
_GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::find_last_of(__c, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_first_not_of(const basic_string& __str, size_type __pos = 0) const
|
|
|
|
_GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::find_first_not_of(__str, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string_len(__s, __n);
|
|
|
|
return _Base::find_first_not_of(__s, __pos, __n);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_first_not_of(const _CharT* __s, size_type __pos = 0) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::find_first_not_of(__s, __pos);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_first_not_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::find_first_not_of(__c, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_last_not_of(const basic_string& __str,
|
|
|
|
size_type __pos = _Base::npos) const
|
|
|
|
_GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::find_last_not_of(__str, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::find_last_not_of(__s, __pos, __n);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_last_not_of(const _CharT* __s, size_type __pos = _Base::npos) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::find_last_not_of(__s, __pos);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
size_type
|
|
|
|
find_last_not_of(_CharT __c, size_type __pos = _Base::npos) const
|
|
|
|
_GLIBCXX_NOEXCEPT
|
|
|
|
{ return _Base::find_last_not_of(__c, __pos); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
basic_string
|
|
|
|
substr(size_type __pos = 0, size_type __n = _Base::npos) const
|
|
|
|
{ return basic_string(_Base::substr(__pos, __n)); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
int
|
|
|
|
compare(const basic_string& __str) const
|
|
|
|
{ return _Base::compare(__str); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
int
|
|
|
|
compare(size_type __pos1, size_type __n1,
|
|
|
|
const basic_string& __str) const
|
|
|
|
{ return _Base::compare(__pos1, __n1, __str); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
int
|
|
|
|
compare(size_type __pos1, size_type __n1, const basic_string& __str,
|
2003-11-12 04:09:16 +08:00
|
|
|
size_type __pos2, size_type __n2) const
|
2018-07-07 01:02:33 +08:00
|
|
|
{ return _Base::compare(__pos1, __n1, __str, __pos2, __n2); }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
int
|
|
|
|
compare(const _CharT* __s) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::compare(__s);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 5. string::compare specification questionable
|
|
|
|
int
|
|
|
|
compare(size_type __pos1, size_type __n1, const _CharT* __s) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__s);
|
|
|
|
return _Base::compare(__pos1, __n1, __s);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 5. string::compare specification questionable
|
|
|
|
int
|
|
|
|
compare(size_type __pos1, size_type __n1,const _CharT* __s,
|
|
|
|
size_type __n2) const
|
|
|
|
{
|
|
|
|
__glibcxx_check_string_len(__s, __n2);
|
|
|
|
return _Base::compare(__pos1, __n1, __s, __n2);
|
|
|
|
}
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
_Base&
|
|
|
|
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
const _Base&
|
|
|
|
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
2003-11-12 04:09:16 +08:00
|
|
|
|
2018-07-07 01:02:33 +08:00
|
|
|
using _Safe::_M_invalidate_all;
|
|
|
|
};
|
2003-11-12 04:09:16 +08:00
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline basic_string<_CharT,_Traits,_Allocator>
|
|
|
|
operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{ return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; }
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline basic_string<_CharT,_Traits,_Allocator>
|
|
|
|
operator+(const _CharT* __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
{
|
2003-11-12 04:09:16 +08:00
|
|
|
__glibcxx_check_string(__lhs);
|
|
|
|
return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline basic_string<_CharT,_Traits,_Allocator>
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
operator+(_CharT __lhs,
|
2003-11-12 04:09:16 +08:00
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{ return basic_string<_CharT,_Traits,_Allocator>(1, __lhs) += __rhs; }
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline basic_string<_CharT,_Traits,_Allocator>
|
|
|
|
operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const _CharT* __rhs)
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
{
|
2003-11-12 04:09:16 +08:00
|
|
|
__glibcxx_check_string(__rhs);
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;
|
2003-11-12 04:09:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline basic_string<_CharT,_Traits,_Allocator>
|
|
|
|
operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
_CharT __rhs)
|
|
|
|
{ return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; }
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
inline bool
|
2003-11-12 04:09:16 +08:00
|
|
|
operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{ return __lhs._M_base() == __rhs._M_base(); }
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator==(const _CharT* __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__lhs);
|
|
|
|
return __lhs == __rhs._M_base();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const _CharT* __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__rhs);
|
|
|
|
return __lhs._M_base() == __rhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
inline bool
|
2003-11-12 04:09:16 +08:00
|
|
|
operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{ return __lhs._M_base() != __rhs._M_base(); }
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator!=(const _CharT* __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__lhs);
|
|
|
|
return __lhs != __rhs._M_base();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const _CharT* __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__rhs);
|
|
|
|
return __lhs._M_base() != __rhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
inline bool
|
2003-11-12 04:09:16 +08:00
|
|
|
operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{ return __lhs._M_base() < __rhs._M_base(); }
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator<(const _CharT* __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__lhs);
|
|
|
|
return __lhs < __rhs._M_base();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const _CharT* __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__rhs);
|
|
|
|
return __lhs._M_base() < __rhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
inline bool
|
2003-11-12 04:09:16 +08:00
|
|
|
operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{ return __lhs._M_base() <= __rhs._M_base(); }
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator<=(const _CharT* __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__lhs);
|
|
|
|
return __lhs <= __rhs._M_base();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const _CharT* __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__rhs);
|
|
|
|
return __lhs._M_base() <= __rhs;
|
|
|
|
}
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
inline bool
|
2003-11-12 04:09:16 +08:00
|
|
|
operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{ return __lhs._M_base() >= __rhs._M_base(); }
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator>=(const _CharT* __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__lhs);
|
|
|
|
return __lhs >= __rhs._M_base();
|
|
|
|
}
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const _CharT* __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__rhs);
|
|
|
|
return __lhs._M_base() >= __rhs;
|
|
|
|
}
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
inline bool
|
2003-11-12 04:09:16 +08:00
|
|
|
operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{ return __lhs._M_base() > __rhs._M_base(); }
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator>(const _CharT* __lhs,
|
|
|
|
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__lhs);
|
|
|
|
return __lhs > __rhs._M_base();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
const _CharT* __rhs)
|
|
|
|
{
|
|
|
|
__glibcxx_check_string(__rhs);
|
|
|
|
return __lhs._M_base() > __rhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 21.3.7.8:
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
inline void
|
2003-11-12 04:09:16 +08:00
|
|
|
swap(basic_string<_CharT,_Traits,_Allocator>& __lhs,
|
|
|
|
basic_string<_CharT,_Traits,_Allocator>& __rhs)
|
|
|
|
{ __lhs.swap(__rhs); }
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
std::basic_ostream<_CharT, _Traits>&
|
|
|
|
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
|
|
|
|
const basic_string<_CharT, _Traits, _Allocator>& __str)
|
|
|
|
{ return __os << __str._M_base(); }
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
std::basic_istream<_CharT,_Traits>&
|
|
|
|
operator>>(std::basic_istream<_CharT,_Traits>& __is,
|
|
|
|
basic_string<_CharT,_Traits,_Allocator>& __str)
|
|
|
|
{
|
|
|
|
std::basic_istream<_CharT,_Traits>& __res = __is >> __str._M_base();
|
|
|
|
__str._M_invalidate_all();
|
|
|
|
return __res;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
std::basic_istream<_CharT,_Traits>&
|
|
|
|
getline(std::basic_istream<_CharT,_Traits>& __is,
|
|
|
|
basic_string<_CharT,_Traits,_Allocator>& __str, _CharT __delim)
|
|
|
|
{
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
std::basic_istream<_CharT,_Traits>& __res = getline(__is,
|
2003-11-12 04:09:16 +08:00
|
|
|
__str._M_base(),
|
|
|
|
__delim);
|
|
|
|
__str._M_invalidate_all();
|
|
|
|
return __res;
|
|
|
|
}
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
std::basic_istream<_CharT,_Traits>&
|
|
|
|
getline(std::basic_istream<_CharT,_Traits>& __is,
|
|
|
|
basic_string<_CharT,_Traits,_Allocator>& __str)
|
|
|
|
{
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
std::basic_istream<_CharT,_Traits>& __res = getline(__is,
|
2003-11-12 04:09:16 +08:00
|
|
|
__str._M_base());
|
|
|
|
__str._M_invalidate_all();
|
|
|
|
return __res;
|
|
|
|
}
|
2005-05-24 18:58:22 +08:00
|
|
|
|
|
|
|
typedef basic_string<char> string;
|
|
|
|
|
|
|
|
#ifdef _GLIBCXX_USE_WCHAR_T
|
|
|
|
typedef basic_string<wchar_t> wstring;
|
|
|
|
#endif
|
|
|
|
|
2013-08-02 03:54:46 +08:00
|
|
|
template<typename _CharT, typename _Traits, typename _Allocator>
|
|
|
|
struct _Insert_range_from_self_is_safe<
|
|
|
|
__gnu_debug::basic_string<_CharT, _Traits, _Allocator> >
|
|
|
|
{ enum { __value = 1 }; };
|
|
|
|
|
2003-11-12 04:09:16 +08:00
|
|
|
} // namespace __gnu_debug
|
|
|
|
|
bitset, [...]: Remove trailing whitespace.
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
From-SVN: r74463
2003-12-09 12:26:28 +08:00
|
|
|
#endif
|