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

@@ -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);