std::basic_string::assign
Da cppreference.com.
< cpp | string | basic string
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
basic_string& assign( size_type count, CharT ch ); | (1) | |
basic_string& assign(const basic_string& str ); | (2) | |
basic_string& assign(const basic_string& str, size_type pos, | (3) | |
basic_string& assign( basic_string&& str ); | (4) | (dal C++11) |
basic_string& assign(const CharT* s, size_type count ); | (5) | |
basic_string& assign(const CharT* s ); | (6) | |
template<class InputIt > basic_string& assign( InputIt first, InputIt last ); | (7) | |
basic_string& assign(std::initializer_list<CharT> ilist ); | (8) | (dal C++11) |
Sostituisce il contenuto della stringa.
1) Original:
Replaces the contents of the string.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Sostituisce il contenuto con le copie di
2) count
ch
charactorOriginal:
Replaces the contents with
count
copies of charactor ch
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Sostituisce il contenuto con una copia di
3) str
Original:
Replaces the contents with a copy of
str
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Sostituisce il contenuto con un
4) [pos, pos+count)
sottostringa di str
. Se la sottostringa richiesto dura oltre la fine della stringa, o se count == npos, la sottostringa risultante è [pos, size())
. Se pos >= str.size(), std::out_of_range viene gettato. Original:
Replaces the contents with a substring
[pos, pos+count)
of str
. If the requested substring lasts past the end of the string, or if count == npos, the resulting substring is [pos, size())
. If pos >= str.size(), std::out_of_range is thrown. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Sostituisce il contenuto con quelli della
5) str
usando la semantica spostamento. str
è in stato indefinito dopo l'operazione.Original:
Replaces the contents with those of
str
using move semantics. str
is in undefined state after the operation.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Sostituisce il contenuto con i personaggi
6) count
primi stringa di caratteri puntato da s
. s
può contenere caratteri nulli.Original:
Replaces the contents with the first
count
characters of character string pointed to by s
. 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.
You can help to correct and verify the translation. Click here for instructions.
Sostituisce il contenuto con quelli della stringa con terminazione null di caratteri puntata da
7) s
. La lunghezza della stringa è determinata dal carattere null prima. Original:
Replaces the contents with those of null-terminated character string pointed to by
s
. The length of the string is determined by the first null character. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Sostituisce il contenuto con copie dei personaggi del
8) [first, last)
gammaOriginal:
Replaces the contents with copies of the characters in 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.
You can help to correct and verify the translation. Click here for instructions.
Sostituisce il contenuto con quelli della lista di inizializzazione
ilist
.Original:
Replaces the contents with those of the 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.
You can help to correct and verify the translation. Click here for instructions.
Indice |
[modifica]Parametri
count | - | dimensione della stringa risultante Original: size of the resulting string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
ch | - | valore per inizializzare i caratteri della stringa con Original: value to initialize characters of the string with The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
first, last | - | gamma di copiare i personaggi Original: range to copy 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. |
str | - | stringa da utilizzare come sorgente per inizializzare i personaggi con Original: string to be used as source to initialize the characters with The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
s | - | puntatore a una stringa di caratteri use come fonte per inizializzare la stringa con Original: pointer to a character string to use as source to initialize the string with The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
init | - | inizializzatore lista per inizializzare i caratteri della stringa con Original: initializer list to initialize the characters of the string with 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 . |
[modifica]Valore di ritorno
*this
[modifica]Complessità
1)lineare in
2) count
Original:
linear in
count
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
lineare in dimensione
3) str
Original:
linear in size of
str
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
lineare in
4) count
Original:
linear in
count
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
costante. Se
5) alloc
è dato e alloc != other.get_allocator(), quindi lineare.Original:
constant. If
alloc
is given and alloc != other.get_allocator(), then linear.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
lineare in
6) count
Original:
linear in
count
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
lineare in dimensione
7) s
Original:
linear in size of
s
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
lineare di distanza tra
8) first
e last
Original:
linear in distance between
first
and last
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
lineare in dimensione
init
Original:
linear in size of
init
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifica]Esempio
This section is incomplete Reason: no example |
[modifica]Vedi anche
costruisce una basic_string (metodo pubblico) | |
assegna valori ad una stringa (metodo pubblico) |