This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
1323.basic_string::replace
should use const_iterator
Section: 27.4.3.7.6 [string.replace] Status: C++11 Submitter: Daniel Krügler Opened: 2010-02-19 Last modified: 2016-11-12
Priority: Not Prioritized
View all other issues in [string.replace].
View all issues with C++11 status.
Discussion:
In contrast to all library usages of purely positional iterator values several overloads of std::basic_string::replace
still use iterator instead of const_iterator
arguments. The paper N3021 quite nicely visualizes the purely positional responsibilities of the function arguments.
This should be fixed to make the library consistent, the proposed changes are quite mechanic.
[ Post-Rapperswil: ]
Moved to Tentatively Ready after 5 positive votes on c++std-lib.
[ Adopted at 2010-11 Batavia ]
Proposed resolution:
In 27.4.3 [basic.string], class template basic_string
synopsis change as indicated:
// 21.4.6 modifiers: ... basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str); basic_string& replace(const_iterator i1, const_iterator i2, const charT* s, size_type n); basic_string& replace(const_iterator i1, const_iterator i2, const charT* s); basic_string& replace(const_iterator i1, const_iterator i2, size_type n, charT c); template<class InputIterator> basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2); basic_string& replace(const_iterator, const_iterator, initializer_list<charT>);
In 27.4.3.7.6 [string.replace] before p.18, change the following signatures as indicated:
basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
In 27.4.3.7.6 [string.replace] before p.21, change the following signatures as indicated:
basic_string& replace(const_iterator i1, const_iterator i2, const charT* s, size_type n);
In 27.4.3.7.6 [string.replace] before p.24, change the following signatures as indicated:
basic_string& replace(const_iterator i1, const_iterator i2, const charT* s);
In 27.4.3.7.6 [string.replace] before p.27, change the following signatures as indicated:
basic_string& replace(const_iterator i1, const_iterator i2, size_type n, charT c);
In 27.4.3.7.6 [string.replace] before p.30, change the following signatures as indicated:
template<class InputIterator> basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
In 27.4.3.7.6 [string.replace] before p.33, change the following signatures as indicated:
basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il);
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4