mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-30 07:14:09 +08:00
basic_string.h (_S_find(const _CharT* __beg, const _CharT* __end, _CharT __c): Remove.
2001-01-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/basic_string.h (_S_find(const _CharT* __beg, const _CharT* __end, _CharT __c): Remove. * include/bits/basic_string.tcc: Substitute traits::find for _S_find. * include/bits/char_traits.h: Tweak. From-SVN: r38961
This commit is contained in:
parent
d02853261b
commit
976448273e
@ -1,3 +1,10 @@
|
||||
2001-01-12 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* include/bits/basic_string.h (_S_find(const _CharT* __beg, const
|
||||
_CharT* __end, _CharT __c): Remove.
|
||||
* include/bits/basic_string.tcc: Substitute traits::find for _S_find.
|
||||
* include/bits/char_traits.h: Tweak.
|
||||
|
||||
2001-01-12 Laurynas Biveinis <lauras@softhome.net>
|
||||
|
||||
* acinclude.m4 (GLIBCPP_CHECK_CTYPE_SUPPORT): check for DJGPP <ctype.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Components for manipulating sequences of characters -*- C++ -*-
|
||||
|
||||
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
//
|
||||
// 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
|
||||
@ -839,10 +839,6 @@ namespace std {
|
||||
int
|
||||
compare(size_type __pos, size_type __n1, const _CharT* __s,
|
||||
size_type __n2 = npos) const;
|
||||
|
||||
private:
|
||||
static const _CharT*
|
||||
_S_find(const _CharT* __beg, const _CharT* __end, _CharT __c);
|
||||
};
|
||||
|
||||
|
||||
|
@ -574,23 +574,15 @@ namespace std
|
||||
return __n;
|
||||
}
|
||||
|
||||
// String operations
|
||||
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||
const _CharT*
|
||||
basic_string<_CharT, _Traits, _Alloc>::
|
||||
_S_find(const _CharT* __beg, const _CharT* __end, _CharT __c)
|
||||
{
|
||||
return find_if(__beg, __end, _Char_traits_match<_CharT, _Traits>(__c));
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||
basic_string<_CharT, _Traits, _Alloc>::size_type
|
||||
basic_string<_CharT, _Traits, _Alloc>::
|
||||
find(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
size_type __size = this->size();
|
||||
size_t __xpos = __pos;
|
||||
const _CharT* __data = _M_data();
|
||||
for (; __xpos + __n <= this->size(); ++__xpos)
|
||||
for (; __xpos + __n <= __size; ++__xpos)
|
||||
if (traits_type::compare(__data + __xpos, __s, __n) == 0)
|
||||
return __xpos;
|
||||
return npos;
|
||||
@ -606,9 +598,9 @@ namespace std
|
||||
if (__pos < __size)
|
||||
{
|
||||
const _CharT* __data = _M_data();
|
||||
const _CharT* __end = __data + __size;
|
||||
const _CharT* __p = _S_find(__data + __pos, __end, __c);
|
||||
if (__p != __end)
|
||||
size_type __n = __size - __pos;
|
||||
const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
|
||||
if (__p)
|
||||
__ret = __p - __data;
|
||||
}
|
||||
return __ret;
|
||||
@ -659,11 +651,10 @@ namespace std
|
||||
basic_string<_CharT, _Traits, _Alloc>::
|
||||
find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
const _CharT* __end = __s + __n;
|
||||
for (; __n && __pos < this->size(); ++__pos)
|
||||
{
|
||||
const _CharT* __p = _S_find(__s, __end, _M_data()[__pos]);
|
||||
if (__p != __end)
|
||||
const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);
|
||||
if (__p)
|
||||
return __pos;
|
||||
}
|
||||
return npos;
|
||||
@ -681,8 +672,7 @@ namespace std
|
||||
__size = __pos;
|
||||
do
|
||||
{
|
||||
const _CharT* __p = _S_find(__s, __s + __n, _M_data()[__size]);
|
||||
if (__p != __s + __n)
|
||||
if (traits_type::find(__s, __n, _M_data()[__size]))
|
||||
return __size;
|
||||
}
|
||||
while (__size-- != 0);
|
||||
@ -697,7 +687,7 @@ namespace std
|
||||
{
|
||||
size_t __xpos = __pos;
|
||||
for (; __n && __xpos < this->size(); ++__xpos)
|
||||
if (_S_find(__s, __s + __n, _M_data()[__xpos]) == __s + __n)
|
||||
if (!traits_type::find(__s, __n, _M_data()[__xpos]))
|
||||
return __xpos;
|
||||
return npos;
|
||||
}
|
||||
@ -708,7 +698,7 @@ namespace std
|
||||
find_first_not_of(_CharT __c, size_type __pos) const
|
||||
{
|
||||
size_t __xpos = __pos;
|
||||
for (; __xpos < size(); ++__xpos)
|
||||
for (; __xpos < this->size(); ++__xpos)
|
||||
if (!traits_type::eq(_M_data()[__xpos], __c))
|
||||
return __xpos;
|
||||
return npos;
|
||||
@ -726,7 +716,7 @@ namespace std
|
||||
__size = __pos;
|
||||
do
|
||||
{
|
||||
if (_S_find(__s, __s + __n, _M_data()[__size]) == __s + __n)
|
||||
if (!traits_type::find(__s, __n, _M_data()[__size]))
|
||||
return __size;
|
||||
}
|
||||
while (__size--);
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Character Traits for use by standard string and iostream -*- C++ -*-
|
||||
|
||||
// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
//
|
||||
// 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
|
||||
@ -144,6 +144,7 @@ namespace std {
|
||||
{ return eq_int_type(__c, eof()) ? int_type(0) : __c; }
|
||||
};
|
||||
|
||||
|
||||
// 21.1.4 char_traits specializations
|
||||
template<>
|
||||
struct char_traits<char>
|
||||
@ -297,7 +298,7 @@ namespace std {
|
||||
_Char_traits_match(_CharT const& __c) : _M_c(__c) { }
|
||||
|
||||
bool
|
||||
operator()(_CharT const& __a) { return _Traits::eq(_M_c,__a); }
|
||||
operator()(_CharT const& __a) { return _Traits::eq(_M_c, __a); }
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
Loading…
Reference in New Issue
Block a user