Espaços nominais
Variantes
Acções

Diferenças entre edições de "cpp/string/basic string/insert"

Da cppreference.com
< cpp‎ | string‎ | basic string
m (r2.7.3) (Robô: A adicionar: en, es, fr, it, zh A remover: pt)
m (Use {{lc}}. Update links. Various fixes.)
 
Linha 2: Linha 2:
 
{{cpp/string/basic_string/title | insert}}
 
{{cpp/string/basic_string/title | insert}}
 
{{cpp/string/basic_string/navbar}}
 
{{cpp/string/basic_string/navbar}}
{{ddcl list begin}}
+
{{begin}}
{{ddcl list item | num=1 |
+
{{| num=1 |
 
basic_string& insert( size_type index, size_type count, CharT ch );
 
basic_string& insert( size_type index, size_type count, CharT ch );
 
}}
 
}}
{{ddcl list item | num=2 |
+
{{| num=2 |
 
basic_string& insert( size_type index, const CharT* s );
 
basic_string& insert( size_type index, const CharT* s );
 
}}
 
}}
{{ddcl list item | num=3 |
+
{{| num=3 |
 
basic_string& insert( size_type index, const CharT* s, size_type count );
 
basic_string& insert( size_type index, const CharT* s, size_type count );
 
}}
 
}}
{{ddcl list item | num=4 |
+
{{| num=4 |
 
basic_string& insert( size_type index, const basic_string& str );
 
basic_string& insert( size_type index, const basic_string& str );
 
}}
 
}}
{{ddcl list item | num=5 |
+
{{| num=5 |
 
basic_string& insert( size_type index, const basic_string& str,
 
basic_string& insert( size_type index, const basic_string& str,
 
                       size_type index_str, size_type count );
 
                       size_type index_str, size_type count );
 
}}
 
}}
{{ddcl list item | num=6 | notes={{mark until c++11}} <br> {{mark since c++11}} |
+
{{| num=6 | notes={{mark until c++11}} <br> {{mark since c++11}} |
 
iterator insert( iterator pos, CharT ch );
 
iterator insert( iterator pos, CharT ch );
 
iterator insert( const_iterator pos, CharT ch );
 
iterator insert( const_iterator pos, CharT ch );
 
}}
 
}}
{{ddcl list item | num=7 | notes={{mark until c++11}} <br> {{mark since c++11}} |
+
{{| num=7 | notes={{mark until c++11}} <br> {{mark since c++11}} |
 
void insert( iterator pos, size_type count, CharT ch );
 
void insert( iterator pos, size_type count, CharT ch );
 
iterator insert( iterator pos, size_type count, CharT ch );
 
iterator insert( iterator pos, size_type count, CharT ch );
 
}}
 
}}
{{ddcl list item | num=8 | notes={{mark until c++11}} <br><br> {{mark since c++11}} |
+
{{| num=8 | notes={{mark until c++11}} <br><br> {{mark since c++11}} |
 
template< class InputIt >
 
template< class InputIt >
 
void insert( iterator i, InputIt first, InputIt last );
 
void insert( iterator i, InputIt first, InputIt last );
Linha 33: Linha 33:
 
iterator insert( const_iterator i, InputIt first, InputIt last );
 
iterator insert( const_iterator i, InputIt first, InputIt last );
 
}}
 
}}
{{ddcl list item | num=9 | notes={{mark since c++11}} |
+
{{| num=9 | sincec++11 |
 
iterator insert( const_iterator pos, std::initializer_list<CharT> ilist );
 
iterator insert( const_iterator pos, std::initializer_list<CharT> ilist );
 
}}
 
}}
{{ddcl list end}}
+
{{end}}
  
 
{{tr|Insere caracteres para a string:|Inserts characters into the string:}}
 
{{tr|Insere caracteres para a string:|Inserts characters into the string:}}
Linha 59: Linha 59:
  
 
===Parâmetros===
 
===Parâmetros===
{{param list begin}}
+
{{begin}}
{{param list item | index |{{tr| posição na qual o conteúdo será inserido| position at which the content will be inserted}}}}
+
{{| index |{{tr| posição na qual o conteúdo será inserido| position at which the content will be inserted}}}}
{{param list item | pos |{{tr| iterador antes que os personagens serão inseridos| iterator before which the characters will be inserted}}}}
+
{{| pos |{{tr| iterador antes que os personagens serão inseridos| iterator before which the characters will be inserted}}}}
{{param list item | ch |{{tr| personagem para inserir| character to insert}}}}
+
{{| ch |{{tr| personagem para inserir| character to insert}}}}
{{param list item | count |{{tr| número de caracteres para inserir| number of characters to insert}}}}
+
{{| count |{{tr| número de caracteres para inserir| number of characters to insert}}}}
{{param list item | s |{{tr| ponteiro para a cadeia de caracteres a ser inserido| pointer to the character string to insert}}}}
+
{{| s |{{tr| ponteiro para a cadeia de caracteres a ser inserido| pointer to the character string to insert}}}}
{{param list item | str |{{tr| string para inserir| string to insert}}}}
+
{{| str |{{tr| string para inserir| string to insert}}}}
{{param list item | first, last |{{tr| vão definir caracteres para inserir| range defining characters to insert}}}}
+
{{| first, last |{{tr| vão definir caracteres para inserir| range defining characters to insert}}}}
{{param list item | index_str |{{tr| posição do primeiro caractere na seqüência {{tt|str}} inserir| position of the first character in the string {{tt|str}} to insert}}}}
+
{{| index_str |{{tr| posição do primeiro caractere na seqüência {{tt|str}} inserir| position of the first character in the string {{tt|str}} to insert}}}}
{{param list item | ilist |{{tr| inicializador lista para inserir os caracteres| initializer list to insert the characters from}}}}
+
{{| ilist |{{tr| inicializador lista para inserir os caracteres| initializer list to insert the characters from}}}}
{{param list hreq}}
+
{{hreq}}
{{param list req concept | InputIt | InputIterator}}
+
{{req concept | InputIt | InputIterator}}
{{param list end}}
+
{{end}}
  
 
===Valor de retorno===
 
===Valor de retorno===
Linha 79: Linha 79:
  
 
===Exceções===
 
===Exceções===
@1@ {{c|std::out_of_range}} if {{c|index > size()}} and {{c|std::length_error}} if {{c|size() + count > max_size()}}.
+
@1@ {{|std::out_of_range}} if {{c|index > size()}} and {{|std::length_error}} if {{c|size() + count > max_size()}}.
  
@2@ {{c|std::out_of_range}} if {{c|index > size()}} and {{c|std::length_error}} if {{c|size() + Traits::length(s) > max_size()}}.
+
@2@ {{|std::out_of_range}} if {{c|index > size()}} and {{|std::length_error}} if {{c|size() + Traits::length(s) > max_size()}}.
  
@3@ {{c|std::out_of_range}} if {{c|index > size()}} and {{c|std::length_error}} if {{c|size() + count > max_size()}}.
+
@3@ {{|std::out_of_range}} if {{c|index > size()}} and {{|std::length_error}} if {{c|size() + count > max_size()}}.
  
 
@4@ {{tr|Lança exceções nas seguintes condições:|Throws exceptions on the following conditions:}}
 
@4@ {{tr|Lança exceções nas seguintes condições:|Throws exceptions on the following conditions:}}
:@a@ {{c|std::out_of_range}} if {{c|index > size()}}.
+
:@a@ {{|std::out_of_range}} if {{c|index > size()}}.
:@b@ {{tr|{{c|std::length_error}} se {{c|size() + str.size() > max_size()}} onde {{tt|ins_count}} é o número de caracteres que serão inseridos.|{{c|std::length_error}} if {{c|size() + str.size() > max_size()}} where {{tt|ins_count}} is the number of characters that will be inserted.}}
+
:@b@ {{tr|{{|std::length_error}} se {{c|size() + str.size() > max_size()}} onde {{tt|ins_count}} é o número de caracteres que serão inseridos.|{{|std::length_error}} if {{c|size() + str.size() > max_size()}} where {{tt|ins_count}} is the number of characters that will be inserted.}}
  
 
@5@ {{tr|Lança exceções nas seguintes condições:|Throws exceptions on the following conditions:}}
 
@5@ {{tr|Lança exceções nas seguintes condições:|Throws exceptions on the following conditions:}}
:@a@ {{c|std::out_of_range}} if {{c|index > size()}}.
+
:@a@ {{|std::out_of_range}} if {{c|index > size()}}.
:@b@ {{c|std::out_of_range}} if {{c|index_str > str.size()}}.
+
:@b@ {{|std::out_of_range}} if {{c|index_str > str.size()}}.
:@c@ {{tr|{{c|std::length_error}} se {{c|size() + ins_count > max_size()}} onde {{tt|ins_count}} é o número de caracteres que serão inseridos.|{{c|std::length_error}} if {{c|size() + ins_count > max_size()}} where {{tt|ins_count}} is the number of characters that will be inserted.}}
+
:@c@ {{tr|{{|std::length_error}} se {{c|size() + ins_count > max_size()}} onde {{tt|ins_count}} é o número de caracteres que serão inseridos.|{{|std::length_error}} if {{c|size() + ins_count > max_size()}} where {{tt|ins_count}} is the number of characters that will be inserted.}}
  
 
@6-9@ {{tr|(Nenhum)|(none)}}
 
@6-9@ {{tr|(Nenhum)|(none)}}
  
 
===Veja também===
 
===Veja também===
{{dcl list begin}}
+
{{begin}}
{{dcl list template | cpp/string/basic_string/dcl list append}}
+
{{| cpp/string/basic_string/append}}
{{dcl list template | cpp/string/basic_string/dcl list push_back}}
+
{{| cpp/string/basic_string/push_back}}
{{dcl list end}}
+
{{end}}
  
 
[[de:cpp/string/basic string/insert]]
 
[[de:cpp/string/basic string/insert]]

Edição actual desde as 10h22min de 2 de julho de 2013

 
 
Biblioteca cordas
Strings terminadas
Original:
Null-terminated strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Cadeias de bytes
Multibyte cordas
Cordas de largura
Classes
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
std::basic_string
Funções de membro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::basic_string
basic_string::operator=
basic_string::assign
basic_string::get_allocator
acesso. Elemento
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::at
basic_string::operator[]
basic_string::front(C++11)
basic_string::back(C++11)
basic_string::data
basic_string::c_str
Iteradores
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::begin
basic_string::cbegin

(C++11)
basic_string::end
basic_string::cend

(C++11)
basic_string::rbegin
basic_string::crbegin

(C++11)
basic_string::rend
basic_string::crend

(C++11)
Capacidade
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::empty
basic_string::size
basic_string::length
basic_string::max_size
basic_string::reserve
basic_string::capacity
basic_string::shrink_to_fit(C++11)
Operações
Original:
Operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::clear
basic_string::insert
basic_string::erase
basic_string::push_back
basic_string::pop_back(C++11)
basic_string::append
basic_string::operator+=
basic_string::compare
basic_string::replace
basic_string::substr
basic_string::copy
basic_string::resize
basic_string::swap
Pesquisar
Original:
Search
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::find
basic_string::rfind
basic_string::find_first_of
basic_string::find_first_not_of
basic_string::find_last_of
basic_string::find_last_not_of
Constantes
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string::npos
Não-membros funções
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)(C++11)(C++11)
(C++11)(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
Classes auxiliares
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
basic_string& insert( size_type index, size_type count, CharT ch );
(1)
basic_string& insert( size_type index, const CharT* s );
(2)
basic_string& insert( size_type index, const CharT* s, size_type count );
(3)
basic_string& insert( size_type index, const basic_string& str );
(4)
basic_string& insert( size_type index, const basic_string& str,
                      size_type index_str, size_type count );
(5)
iterator insert( iterator pos, CharT ch );
iterator insert( const_iterator pos, CharT ch );
(6) (até C++11)
(desde C++11)
void insert( iterator pos, size_type count, CharT ch );
iterator insert( iterator pos, size_type count, CharT ch );
(7) (até C++11)
(desde C++11)
template< class InputIt >

void insert( iterator i, InputIt first, InputIt last );
template< class InputIt >

iterator insert( const_iterator i, InputIt first, InputIt last );
(8) (até C++11)

(desde C++11)
iterator insert( const_iterator pos, std::initializer_list<CharT> ilist );
(9) (desde C++11)
Insere caracteres para a string:
Original:
Inserts characters into the string:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Insere count cópias de ch personagem no index posição
Original:
Inserts count copies of character ch at the position index
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Insere seqüência de caracteres terminada em nulo apontado por s no index posição. O comprimento da corda é determinada pelo primeiro caractere nulo (efetivamente chamadas Traits::length(s).
Original:
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 (effectively calls Traits::length(s).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Insere os personagens count primeira da seqüência de caracteres apontada por s no index posição. s pode conter caracteres nulos.
Original:
Inserts the first count characters from the character string pointed to by s at the position index. s can contain null characters.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Insere str corda no index posição
Original:
Inserts string str at the position index
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
Insere uma corda, obtidos por str.substr(index_str, count) no index posição
Original:
Inserts a string, obtained by str.substr(index_str, count) at the position index
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
Insere ch personagem antes o caracter apontado por pos
Original:
Inserts character ch before the character pointed by pos
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7)
Insere count cópias de ch personagem antes do elemento apontado por pos
Original:
Inserts count copies of character ch before the element pointed to by pos
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
Insere personagens do [first, last) intervalo
Original:
Inserts characters from the range [first, last)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
Insere elementos da lista de inicializador ilist.
Original:
Inserts elements from initializer list ilist.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Parâmetros

index -
posição na qual o conteúdo será inserido
Original:
position at which the content will be inserted
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pos -
iterador antes que os personagens serão inseridos
Original:
iterator before which the characters will be inserted
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ch -
personagem para inserir
Original:
character to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
count -
número de caracteres para inserir
Original:
number of characters to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
s -
ponteiro para a cadeia de caracteres a ser inserido
Original:
pointer to the character string to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
str -
string para inserir
Original:
string to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
first, last -
vão definir caracteres para inserir
Original:
range defining characters to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
index_str -
posição do primeiro caractere na seqüência str inserir
Original:
position of the first character in the string str to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ilist -
inicializador lista para inserir os caracteres
Original:
initializer list to insert the characters from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Type requirements
-
InputIt must meet the requirements of InputIterator.

[editar] Valor de retorno

1-5) *this
6-9)
Iterator após o último caractere inserido.
Original:
Iterator following the last inserted character.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exceções

1) std::out_of_range if index > size() and std::length_error if size() + count > max_size().
2) std::out_of_range if index > size() and std::length_error if size() + Traits::length(s) > max_size().
3) std::out_of_range if index > size() and std::length_error if size() + count > max_size().
4)
Lança exceções nas seguintes condições:
Original:
Throws exceptions on the following conditions:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
a) std::out_of_range if index > size().
b)
std::length_error se size() + str.size() > max_size() onde ins_count é o número de caracteres que serão inseridos.
Original:
std::length_error if size() + str.size() > max_size() where ins_count is the number of characters that will be inserted.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
Lança exceções nas seguintes condições:
Original:
Throws exceptions on the following conditions:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
a) std::out_of_range if index > size().
b) std::out_of_range if index_str > str.size().
c)
std::length_error se size() + ins_count > max_size() onde ins_count é o número de caracteres que serão inseridos.
Original:
std::length_error if size() + ins_count > max_size() where ins_count is the number of characters that will be inserted.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6-9)
(Nenhum)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Veja também

Acrescenta caracteres até o fim
Original:
appends characters to the end
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro) [edit]
acrescenta um caráter até o fim
Original:
appends a character to the end
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro) [edit]