Namespaces
Variants
Views
Actions

playground

From cppreference.com
synopsis to test
(1)
basic_string& replace( size_type pos, size_type count,
                       const basic_string& str );
(until C++20)
constexpr basic_string& replace( size_type pos, size_type count,
                                 const basic_string& str );
(constexpr since c++20)
(2)
basic_string& replace( const_iterator first, const_iterator last,
                       const basic_string& str );
(until C++20)
constexpr basic_string& replace( const_iterator first, const_iterator last,
                                 const basic_string& str );
(constexpr since c++20)
(3)
basic_string& replace( size_type pos, size_type count,

                       const basic_string& str,

                       size_type pos2, size_type count2 );
(until C++14)
basic_string& replace( size_type pos, size_type count,

                       const basic_string& str,

                       size_type pos2, size_type count2 = npos );
(since C++14)
(until C++20)
constexpr basic_string& replace( size_type pos, size_type count,

                                 const basic_string& str,

                                 size_type pos2, size_type count2 = npos );
(since C++14)(constexpr since c++20)
(4)
template< class InputIt >

basic_string& replace( const_iterator first, const_iterator last,

                       InputIt first2, InputIt last2 );
(until C++20)
template< class InputIt >

constexpr basic_string& replace( const_iterator first, const_iterator last,

                                 InputIt first2, InputIt last2 );
(constexpr since c++20)
(5)
basic_string& replace( size_type pos, size_type count,
                       const CharT* cstr, size_type count2 );
(until C++20)
constexpr basic_string& replace( size_type pos, size_type count,
                                 const CharT* cstr, size_type count2 );
(constexpr since c++20)
(6)
basic_string& replace( const_iterator first, const_iterator last,
                       const CharT* cstr, size_type count2 );
(until C++20)
constexpr basic_string& replace( const_iterator first, const_iterator last,
                                 const CharT* cstr, size_type count2 );
(constexpr since c++20)
(7)
basic_string& replace( size_type pos, size_type count,
                       const CharT* cstr );
(until C++20)
constexpr basic_string& replace( size_type pos, size_type count,
                                 const CharT* cstr );
(constexpr since c++20)
(8)
basic_string& replace( const_iterator first, const_iterator last,
                       const CharT* cstr );
(until C++20)
constexpr basic_string& replace( const_iterator first, const_iterator last,
                                 const CharT* cstr );
(constexpr since c++20)
(9)
basic_string& replace( size_type pos, size_type count,
                       size_type count2, CharT ch );
(until C++20)
constexpr basic_string& replace( size_type pos, size_type count,
                                 size_type count2, CharT ch );
(constexpr since c++20)
(10)
basic_string& replace( const_iterator first, const_iterator last,
                       size_type count2, CharT ch );
(until C++20)
constexpr basic_string& replace( const_iterator first, const_iterator last,
                                 size_type count2, CharT ch );
(constexpr since c++20)
(11)
basic_string& replace( const_iterator first, const_iterator last,
                       std::initializer_list<CharT> ilist );
(until C++20)
constexpr basic_string& replace( const_iterator first, const_iterator last,
                                 std::initializer_list<CharT> ilist );
(constexpr since c++20)
(12)
template < class T >

basic_string& replace( size_type pos, size_type count,

                       const T& t );
(until C++20)
template < class T >

constexpr basic_string& replace( size_type pos, size_type count,

                                 const T& t );
(constexpr since c++20)
(13)
template < class T >

basic_string& replace( const_iterator first, const_iterator last,

                       const T& t );
(until C++20)
template < class T >

constexpr basic_string& replace( const_iterator first, const_iterator last,

                                 const T& t );
(constexpr since c++20)
(14)
template < class T >

basic_string& replace( size_type pos, size_type count, const T& t,

                       size_type pos2, size_type count2 = npos );
(until C++20)
template < class T >

constexpr basic_string& replace( size_type pos, size_type count, const T& t,

                                 size_type pos2, size_type count2 = npos );
(constexpr since c++20)
  1. First
  2. Second
  3. Third
  4. Fourth
  5. Fifth
    • Fifth-1 [..c++20) (until C++20)
      • Fifth-1-a
      • Fifth-1-b [c++11..) (since C++11)
    • Fifth-2 [c++11..c++20) (since C++11)(until C++20)
      • Fifth-2-a
      • Fifth-2-a
    • Fifth-3 [..c++20) (until C++20)
      • Fifth-3-a
      • Fifth-3-a
    • Fifth-4
      • Fifth-4-a
      • Fifth-4-b [..c++20) (until C++20)
      • Fifth-4-b [c++14..c++20) (since C++14)(until C++20)

The potential scope of a name declared

  • in the init-statement of a [[../for|for loop]],
  • in the condition of a [[../for|for loop]],
  • in the range_declaration of a [[../range-for|range-for loop]],
  • in the init-statement of a [[../if|if statement]] or [[../switch|switch statement]],(since C++17)
  • in the condition of a [[../if|if statement]], [[../switch|switch statement]], or [[../while|while loop]]

begins at the point of declaration and ends at the end of the controlled statement.


Deduction guides

(since C++17)

Deduction guides

(since C++17)

(a slightly optimized variation.)