git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119560 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2010-11-17 21:11:40 +00:00
parent cd2254b454
commit 7b2cb48cc1
8 changed files with 39 additions and 39 deletions

View File

@ -200,13 +200,13 @@ public:
basic_string& replace(size_type pos, size_type n1, const_pointer s, size_type n2);
basic_string& replace(size_type pos, size_type n1, const_pointer s);
basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
basic_string& replace(iterator i1, iterator i2, const basic_string& str);
basic_string& replace(iterator i1, iterator i2, const_pointer s, size_type n);
basic_string& replace(iterator i1, iterator i2, const_pointer s);
basic_string& replace(iterator i1, iterator i2, size_type n, value_type c);
basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s, size_type n);
basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s);
basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
template<class InputIterator>
basic_string& replace(iterator i1, iterator i2, InputIterator j1, InputIterator j2);
basic_string& replace(iterator i1, iterator i2, initializer_list<value_type>);
basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);
size_type copy(pointer s, size_type n, size_type pos = 0) const;
basic_string substr(size_type pos = 0, size_type n = npos) const;
@ -1198,19 +1198,19 @@ public:
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2);
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s);
basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
basic_string& replace(iterator __i1, iterator __i2, const basic_string& __str);
basic_string& replace(iterator __i1, iterator __i2, const_pointer __s, size_type __n);
basic_string& replace(iterator __i1, iterator __i2, const_pointer __s);
basic_string& replace(iterator __i1, iterator __i2, size_type __n, value_type __c);
basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n);
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s);
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
template<class _InputIterator>
typename enable_if
<
__is_input_iterator<_InputIterator>::value,
basic_string&
>::type
replace(iterator __i1, iterator __i2, _InputIterator __j1, _InputIterator __j2);
replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(iterator __i1, iterator __i2, initializer_list<value_type> __il)
basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
{return replace(__i1, __i2, __il.begin(), __il.end());}
size_type copy(pointer __s, size_type __n, size_type __pos = 0) const;
@ -2400,7 +2400,7 @@ typename enable_if
__is_input_iterator<_InputIterator>::value,
basic_string<_CharT, _Traits, _Allocator>&
>::type
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
_InputIterator __j1, _InputIterator __j2)
{
for (; true; ++__i1, ++__j1)
@ -2416,7 +2416,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
erase(__i1, __i2);
break;
}
traits_type::assign(*__i1, *__j1);
traits_type::assign(const_cast<value_type&>(*__i1), *__j1);
}
return *this;
}
@ -2453,7 +2453,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const basic_string& __str)
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1),
__str.data(), __str.size());
@ -2462,7 +2462,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const_pointer __s, size_type __n)
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n);
}
@ -2470,7 +2470,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const_pointer __s)
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s);
}
@ -2478,7 +2478,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, size_type __n, value_type __c)
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c);
}
@ -3719,12 +3719,12 @@ extern template
extern template
enable_if<__is_input_iterator<char const*>::value, string&>::type
string::
replace<char const*>(string::iterator, string::iterator, char const*, char const*);
replace<char const*>(string::const_iterator, string::const_iterator, char const*, char const*);
extern template
enable_if<__is_input_iterator<wchar_t const*>::value, wstring&>::type
wstring::
replace<wchar_t const*>(wstring::iterator, wstring::iterator, wchar_t const*, wchar_t const*);
replace<wchar_t const*>(wstring::const_iterator, wstring::const_iterator, wchar_t const*, wchar_t const*);
extern template
enable_if<__is_forward_iterator<wchar_t*>::value, wstring&>::type

View File

@ -54,12 +54,12 @@ template
template
enable_if<__is_input_iterator<char const*>::value, string&>::type
string::
replace<char const*>(string::iterator, string::iterator, char const*, char const*);
replace<char const*>(string::const_iterator, string::const_iterator, char const*, char const*);
template
enable_if<__is_input_iterator<wchar_t const*>::value, wstring&>::type
wstring::
replace<wchar_t const*>(wstring::iterator, wstring::iterator, wchar_t const*, wchar_t const*);
replace<wchar_t const*>(wstring::const_iterator, wstring::const_iterator, wchar_t const*, wchar_t const*);
template
enable_if<__is_forward_iterator<wchar_t*>::value, wstring&>::type

View File

@ -9,7 +9,7 @@
// <string>
// basic_string& replace(iterator i1, iterator i2, initializer_list<charT> il);
// basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il);
#include <string>
#include <cassert>
@ -19,7 +19,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::string s("123def456");
s.replace(s.begin() + 3, s.begin() + 6, {'a', 'b', 'c'});
s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'});
assert(s == "123abc456");
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

@ -11,7 +11,7 @@
// template<class InputIterator>
// basic_string&
// replace(iterator i1, iterator i2, InputIterator j1, InputIterator j2);
// replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
#include <string>
#include <iterator>
@ -24,8 +24,8 @@ void
test(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l, S expected)
{
typename S::size_type old_size = s.size();
typename S::iterator first = s.begin() + pos1;
typename S::iterator last = s.begin() + pos1 + n1;
typename S::const_iterator first = s.begin() + pos1;
typename S::const_iterator last = s.begin() + pos1 + n1;
s.replace(first, last, f, l);
assert(s.__invariants());
assert(s == expected);

View File

@ -10,7 +10,7 @@
// <string>
// basic_string<charT,traits,Allocator>&
// replace(iterator i1, iterator i2, const charT* s);
// replace(const_iterator i1, const_iterator i2, const charT* s);
#include <stdio.h>
@ -24,8 +24,8 @@ void
test(S s, S::size_type pos1, S::size_type n1, const S::value_type* str, S expected)
{
S::size_type old_size = s.size();
S::iterator first = s.begin() + pos1;
S::iterator last = s.begin() + pos1 + n1;
S::const_iterator first = s.begin() + pos1;
S::const_iterator last = s.begin() + pos1 + n1;
s.replace(first, last, str);
assert(s.__invariants());
assert(s == expected);

View File

@ -10,7 +10,7 @@
// <string>
// basic_string<charT,traits,Allocator>&
// replace(iterator i1, iterator i2, const charT* s, size_type n);
// replace(const_iterator i1, const_iterator i2, const charT* s, size_type n);
#include <stdio.h>
@ -25,8 +25,8 @@ test(S s, S::size_type pos1, S::size_type n1, const S::value_type* str,
S::size_type n2, S expected)
{
S::size_type old_size = s.size();
S::iterator first = s.begin() + pos1;
S::iterator last = s.begin() + pos1 + n1;
S::const_iterator first = s.begin() + pos1;
S::const_iterator last = s.begin() + pos1 + n1;
s.replace(first, last, str, n2);
assert(s.__invariants());
assert(s == expected);

View File

@ -10,7 +10,7 @@
// <string>
// basic_string<charT,traits,Allocator>&
// replace(iterator i1, iterator i2, size_type n, charT c);
// replace(const_iterator i1, const_iterator i2, size_type n, charT c);
#include <stdio.h>
@ -25,8 +25,8 @@ test(S s, S::size_type pos1, S::size_type n1, S::size_type n2,
S::value_type c, S expected)
{
S::size_type old_size = s.size();
S::iterator first = s.begin() + pos1;
S::iterator last = s.begin() + pos1 + n1;
S::const_iterator first = s.begin() + pos1;
S::const_iterator last = s.begin() + pos1 + n1;
s.replace(first, last, n2, c);
assert(s.__invariants());
assert(s == expected);

View File

@ -10,7 +10,7 @@
// <string>
// basic_string<charT,traits,Allocator>&
// replace(iterator i1, iterator i2, const basic_string& str);
// replace(const_iterator i1, const_iterator i2, const basic_string& str);
#include <stdio.h>
@ -24,8 +24,8 @@ void
test(S s, S::size_type pos1, S::size_type n1, S str, S expected)
{
S::size_type old_size = s.size();
S::iterator first = s.begin() + pos1;
S::iterator last = s.begin() + pos1 + n1;
S::const_iterator first = s.begin() + pos1;
S::const_iterator last = s.begin() + pos1 + n1;
s.replace(first, last, str);
assert(s.__invariants());
assert(s == expected);