Difference between revisions of "cpp/string/basic string/insert"
m (Text replace - "putIterator" to "putIt") |
(+type reqs) |
||
Line 67: | Line 67: | ||
{{param list item | index_str | position of the first character in the string {{tt|str}} to insert.}} | {{param list item | index_str | position of the first character in the string {{tt|str}} to insert.}} | ||
{{param list item | ilist | initializer list to insert the characters from}} | {{param list item | ilist | initializer list to insert the characters from}} | ||
+ | {{param list hreq}} | ||
+ | {{param list req concept | InputIt | InputIterator}} | ||
{{param list end}} | {{param list end}} | ||
Revision as of 06:13, 3 August 2012
Template:ddcl list begin <tr class="t-dcl ">
<td >iterator insert( const_iterator pos, CharT ch );
<td > (1) </td>
<td > (until C++11)
(since C++11) </td>
</tr>
<tr class="t-dcl ">
<td > (2) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">
<td ><td > (3) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">
<td ><td > (4) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">
<td ><td > (5) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">
<td ><td > (6) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">
<td >size_type index_str, size_type count );
<td > (7) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">
<td >void insert( iterator i, InputIt first, InputIt last );
template< class InputIt >
<td > (8) </td>
<td > (until C++11)
(since C++11) </td>
</tr>
<tr class="t-dcl ">
<td > (9) </td> <td > (since C++11) </td> </tr> Template:ddcl list end
Inserts characters into the string:
1) inserts character ch
before the character pointed by pos
2) inserts count
copies of character ch
before the element pointed to by pos
3) inserts count
copies of character ch
at the position index
4) inserts null-terminated character string pointed to by s
at the position index
. The length of the string is determined by the first null character.
5) inserts the first count
characters from the character string pointed to by s
at the position index
. s
can contain null characters.
6) inserts string str
at the position index
7) inserts a string, obtained by str.substr(index_str, count) at the position index
8) inserts characters from the range [first, last)
9) inserts elements from initializer list ilist
.
Contents |
Parameters
pos | - | iterator before which the characters will be inserted |
index | - | position at which the content will be inserted |
ch | - | character to insert |
s | - | pointer to the character string to insert |
str | - | string to insert |
first, last | - | range defining characters to be insert |
count | - | number of characters to insert |
index_str | - | position of the first character in the string str to insert.
|
ilist | - | initializer list to insert the characters from |
Type requirements | ||
-InputIt must meet the requirements of LegacyInputIterator.
|
Return value
1) iterator following the last inserted character.
2-7) *this
8-9) iterator following the last inserted character.
Complexity
This section is incomplete |