From Jason Turner

[string.insert]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpqxmr8to8/{from.md → to.md} +19 -6
tmp/tmpqxmr8to8/{from.md → to.md} RENAMED
@@ -58,22 +58,22 @@ return insert(pos1, sv.substr(pos2, n));
58
  constexpr basic_string& insert(size_type pos, const charT* s, size_type n);
59
  ```
60
 
61
  *Preconditions:* \[`s`, `s + n`) is a valid range.
62
 
63
- *Throws:*
64
-
65
- - `out_of_range` if `pos > size()`,
66
- - `length_error` if `n > max_size() - size()`, or
67
- - any exceptions thrown by `allocator_traits<Allocator>::allocate`.
68
-
69
  *Effects:* Inserts a copy of the range \[`s`, `s + n`) immediately
70
  before the character at position `pos` if `pos < size()`, or otherwise
71
  at the end of the string.
72
 
73
  *Returns:* `*this`.
74
 
 
 
 
 
 
 
75
  ``` cpp
76
  constexpr basic_string& insert(size_type pos, const charT* s);
77
  ```
78
 
79
  *Effects:* Equivalent to: `return insert(pos, s, traits::length(s));`
@@ -128,10 +128,23 @@ iterator [[container.requirements.general]].
128
  `insert(p - begin(), basic_string(first, last, get_allocator()))`.
129
 
130
  *Returns:* An iterator which refers to the first inserted character, or
131
  `p` if `first == last`.
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  ``` cpp
134
  constexpr iterator insert(const_iterator p, initializer_list<charT> il);
135
  ```
136
 
137
  *Effects:* Equivalent to: `return insert(p, il.begin(), il.end());`
 
58
  constexpr basic_string& insert(size_type pos, const charT* s, size_type n);
59
  ```
60
 
61
  *Preconditions:* \[`s`, `s + n`) is a valid range.
62
 
 
 
 
 
 
 
63
  *Effects:* Inserts a copy of the range \[`s`, `s + n`) immediately
64
  before the character at position `pos` if `pos < size()`, or otherwise
65
  at the end of the string.
66
 
67
  *Returns:* `*this`.
68
 
69
+ *Throws:*
70
+
71
+ - `out_of_range` if `pos > size()`,
72
+ - `length_error` if `n > max_size() - size()`, or
73
+ - any exceptions thrown by `allocator_traits<Allocator>::allocate`.
74
+
75
  ``` cpp
76
  constexpr basic_string& insert(size_type pos, const charT* s);
77
  ```
78
 
79
  *Effects:* Equivalent to: `return insert(pos, s, traits::length(s));`
 
128
  `insert(p - begin(), basic_string(first, last, get_allocator()))`.
129
 
130
  *Returns:* An iterator which refers to the first inserted character, or
131
  `p` if `first == last`.
132
 
133
+ ``` cpp
134
+ template<container-compatible-range<charT> R>
135
+ constexpr iterator insert_range(const_iterator p, R&& rg);
136
+ ```
137
+
138
+ *Preconditions:* `p` is a valid iterator on `*this`.
139
+
140
+ *Effects:* Equivalent to
141
+ `insert(p - begin(), basic_string(from_range, std::forward<R>(rg), get_allocator()))`.
142
+
143
+ *Returns:* An iterator which refers to the first inserted character, or
144
+ `p` if `rg` is empty.
145
+
146
  ``` cpp
147
  constexpr iterator insert(const_iterator p, initializer_list<charT> il);
148
  ```
149
 
150
  *Effects:* Equivalent to: `return insert(p, il.begin(), il.end());`