Namespace
Varianti

cpp/string/basic string/assign: differenze tra le versioni

Da cppreference.com.
< cpp‎ | string‎ | basic string
m (r2.7.3) (Bot: Aggiungo de, en, es, fr, zh; tolgo it)
m (Use {{lc}}. Update links. Various fixes.)
 
Riga 2: Riga 2:
 
{{cpp/string/basic_string/title | assign}}
 
{{cpp/string/basic_string/title | assign}}
 
{{cpp/string/basic_string/navbar}}
 
{{cpp/string/basic_string/navbar}}
{{ddcl list begin}}
+
{{begin}}
{{ddcl list item | num=1 |
+
{{| num=1 |
 
basic_string& assign( size_type count, CharT ch );
 
basic_string& assign( size_type count, CharT ch );
 
}}
 
}}
{{ddcl list item | num=2 |  
+
{{| num=2 |  
 
basic_string& assign( const basic_string& str );
 
basic_string& assign( const basic_string& str );
 
}}
 
}}
{{ddcl list item | num=3 |
+
{{| num=3 |
 
basic_string& assign( const basic_string& str,
 
basic_string& assign( const basic_string& str,
 
                       size_type pos,
 
                       size_type pos,
 
                       size_type count );
 
                       size_type count );
 
}}
 
}}
{{ddcl list item | num=4 | notes={{mark since c++11}} |
+
{{| num=4 | sincec++11 |
 
basic_string& assign( basic_string&& str );
 
basic_string& assign( basic_string&& str );
 
}}
 
}}
{{ddcl list item | num=5 |
+
{{| num=5 |
 
basic_string& assign( const CharT* s,
 
basic_string& assign( const CharT* s,
 
                       size_type count );
 
                       size_type count );
 
}}
 
}}
{{ddcl list item | num=6 |
+
{{| num=6 |
 
basic_string& assign( const CharT* s );
 
basic_string& assign( const CharT* s );
 
}}
 
}}
{{ddcl list item | num=7 | 1=
+
{{| num=7 | 1=
 
template< class InputIt >
 
template< class InputIt >
 
basic_string& assign( InputIt first, InputIt last );
 
basic_string& assign( InputIt first, InputIt last );
 
}}
 
}}
{{ddcl list item | num=8 | notes={{mark since c++11}} | 1=
+
{{| num=8 | sincec++11 | 1=
 
basic_string& assign( std::initializer_list<CharT> ilist );
 
basic_string& assign( std::initializer_list<CharT> ilist );
 
}}
 
}}
{{ddcl list end}}
+
{{end}}
  
 
{{tr|Sostituisce il contenuto della stringa.|Replaces the contents of the string.}}
 
{{tr|Sostituisce il contenuto della stringa.|Replaces the contents of the string.}}
Riga 39: Riga 39:
 
2) {{tr|Sostituisce il contenuto con una copia di {{tt|str}}|Replaces the contents with a copy of {{tt|str}}}}
 
2) {{tr|Sostituisce il contenuto con una copia di {{tt|str}}|Replaces the contents with a copy of {{tt|str}}}}
  
3) {{tr|Sostituisce il contenuto con un {{tt|[pos, pos+count)}} sottostringa di {{tt|str}}. Se la sottostringa richiesto dura oltre la fine della stringa, o se {{c|1=count == npos}}, la sottostringa risultante è {{tt|[pos, size())}}. Se {{c|1=pos >= str.size()}}, {{c|std::out_of_range}} viene gettato. |Replaces the contents with a substring {{tt|[pos, pos+count)}} of {{tt|str}}. If the requested substring lasts past the end of the string, or if {{c|1=count == npos}}, the resulting substring is {{tt|[pos, size())}}.  If {{c|1=pos >= str.size()}}, {{c|std::out_of_range}} is thrown. }}
+
3) {{tr|Sostituisce il contenuto con un {{tt|[pos, pos+count)}} sottostringa di {{tt|str}}. Se la sottostringa richiesto dura oltre la fine della stringa, o se {{c|1=count == npos}}, la sottostringa risultante è {{tt|[pos, size())}}. Se {{c|1=pos >= str.size()}}, {{|std::out_of_range}} viene gettato. |Replaces the contents with a substring {{tt|[pos, pos+count)}} of {{tt|str}}. If the requested substring lasts past the end of the string, or if {{c|1=count == npos}}, the resulting substring is {{tt|[pos, size())}}.  If {{c|1=pos >= str.size()}}, {{|std::out_of_range}} is thrown. }}
  
 
4) {{tr|Sostituisce il contenuto con quelli della {{tt|str}} usando la semantica spostamento. {{tt|str}} è in stato indefinito dopo l'operazione.|Replaces the contents with those of {{tt|str}} using move semantics. {{tt|str}} is in undefined state after the operation.}}
 
4) {{tr|Sostituisce il contenuto con quelli della {{tt|str}} usando la semantica spostamento. {{tt|str}} è in stato indefinito dopo l'operazione.|Replaces the contents with those of {{tt|str}} using move semantics. {{tt|str}} is in undefined state after the operation.}}
Riga 52: Riga 52:
  
 
===Parametri===
 
===Parametri===
{{param list begin}}
+
{{begin}}
{{param list item | count |{{tr| dimensione della stringa risultante| size of the resulting string}}}}
+
{{| count |{{tr| dimensione della stringa risultante| size of the resulting string}}}}
{{param list item | ch |{{tr| valore per inizializzare i caratteri della stringa con| value to initialize characters of the string with}}}}
+
{{| ch |{{tr| valore per inizializzare i caratteri della stringa con| value to initialize characters of the string with}}}}
{{param list item | first, last |{{tr| gamma di copiare i personaggi| range to copy the characters from}}}}
+
{{| first, last |{{tr| gamma di copiare i personaggi| range to copy the characters from}}}}
{{param list item | str |{{tr| stringa da utilizzare come sorgente per inizializzare i personaggi con| string to be used as source to initialize the characters with}}}}
+
{{| str |{{tr| stringa da utilizzare come sorgente per inizializzare i personaggi con| string to be used as source to initialize the characters with}}}}
{{param list item | s |{{tr| puntatore a una stringa di caratteri use<br> come fonte per inizializzare la stringa con| pointer to a character string to use<br> as source to initialize the string with}}}}
+
{{| s |{{tr| puntatore a una stringa di caratteri use<br> come fonte per inizializzare la stringa con| pointer to a character string to use<br> as source to initialize the string with}}}}
{{param list item | init |{{tr| inizializzatore lista per inizializzare i caratteri della stringa con| initializer list to initialize the characters of the string with}}}}
+
{{| init |{{tr| inizializzatore lista per inizializzare i caratteri della stringa con| initializer list to initialize the characters of the string with}}}}
{{param list hreq}}
+
{{hreq}}
{{param list req concept | InputIt | InputIterator}}
+
{{req concept | InputIt | InputIterator}}
{{param list end}}  
+
{{end}}  
  
 
===Valore di ritorno===
 
===Valore di ritorno===
Riga 90: Riga 90:
  
 
===Vedi anche===
 
===Vedi anche===
{{dcl list begin}}
+
{{begin}}
{{dcl list template | cpp/string/basic_string/dcl list constructor}}
+
{{| cpp/string/basic_string/constructor}}
{{dcl list template | cpp/string/basic_string/dcl list operator{{=}}}}
+
{{| cpp/string/basic_string/operator{{=}}}}
{{dcl list end}}
+
{{end}}
  
 
[[de:cpp/string/basic string/assign]]
 
[[de:cpp/string/basic string/assign]]

Versione attuale delle 15:05, 2 lug 2013

 
 
Stringhe libreria
Null-stringhe terminate
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.
Byte stringhe
Multibyte stringhe
Stringhe larghe
Classi
Original:
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
char_traits
 
std::basic_string
Membri funzioni
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
Elemento accesso
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
Iteratori
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)
Capacità
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)
Operazioni
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
Cerca
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
Costanti
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
Non membri funzioni
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.
operator+
operator==
operator!=
operator<
operator>
operator<=
operator>=
swap(std::basic_string)
operator<<
operator>>
getline
stoi
stol
stoll
(C++11)
(C++11)
(C++11)
stoul
stoull
(C++11)
(C++11)
stof
stod
stold
(C++11)
(C++11)
(C++11)
to_string(C++11)
to_wstring(C++11)
Helper classi
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.
hash<std::string>
hash<std::wstring>
hash<std::u32string>
hash<std::u16string>
(C++11)
 
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,

                      size_type count );
(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.
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.
1)
Sostituisce il contenuto con le copie di count ch charactor
Original:
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.
2)
Sostituisce il contenuto con una copia di 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.
3)
Sostituisce il contenuto con un [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.
4)
Sostituisce il contenuto con quelli della 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.
5)
Sostituisce il contenuto con i personaggi 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.
6)
Sostituisce il contenuto con quelli della stringa con terminazione null di caratteri puntata da 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.
7)
Sostituisce il contenuto con copie dei personaggi del [first, last) gamma
Original:
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.
8)
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.

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 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.
2)
lineare in dimensione 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.
3)
lineare in 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.
4)
costante. Se 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.
5)
lineare in 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.
6)
lineare in dimensione 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.
7)
lineare di distanza tra 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.
8)
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.

[modifica] Esempio

[modifica] Vedi anche

costruisce una basic_string
(metodo pubblico) [modifica]
assegna valori ad una stringa
(metodo pubblico) [modifica]