Difference between revisions of "cpp/string/basic string/insert"
m (Text replace - "{{cpp|" to "{{c|") |
m (r2.7.3) (Robot: Adding de, ja, pt, ru) |
||
Line 87: | Line 87: | ||
{{dcl list template | cpp/string/basic_string/dcl list push_back}} | {{dcl list template | cpp/string/basic_string/dcl list push_back}} | ||
{{dcl list end}} | {{dcl list end}} | ||
+ | |||
+ | [[de:cpp/string/basic string/insert]] | ||
+ | [[ja:cpp/string/basic string/insert]] | ||
+ | [[pt:cpp/string/basic string/insert]] | ||
+ | [[ru:cpp/string/basic string/insert]] |
Revision as of 16:56, 4 May 2012
Template:cpp/string/basic string/sidebar 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, InputIterator first, InputIterator last );
template< class InputIterator >
<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 |
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 |