std::basic_string
Da cppreference.com.
![]() |
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. |
Defined in header <string>
|
||
template< class CharT, |
||
La classe template
basic_string
negozi e manipola sequenze di caratteri simili a oggetti (vale a dire, gli oggetti per i quali una specializzazione di std::char_traits o compatibili traits della classe è previsto). Original:
The class template
basic_string
stores and manipulates sequences of char-like objects (that is, objects for which a specialization of std::char_traits or compatible traits class is provided). 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.
Gli elementi di un
basic_string
vengono memorizzati in modo contiguo, che è, per un basic_string s
, &*(s.begin() + n) == &*s.begin() + n per ogni n in [0, s.size())
, o, equivalentemente, un puntatore s[0]
può essere passato a funzioni che prevedono un puntatore al primo elemento di un array charT[]
. (dal C++11)Original:
The elements of a
basic_string
are stored contiguously, that is, for a basic_string s
, &*(s.begin() + n) == &*s.begin() + n for any n in [0, s.size())
, or, equivalently, a pointer to s[0]
can be passed to functions that expect a pointer to the first element of a charT[]
array. (dal C++11)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.
Diverse specializzazioni per i tipi di caratteri comuni sono:
Original:
Several specializations for common character types are provided:
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.
Defined in header
<string> | |
Tipo
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
std::string | std::basic_string<char> |
std::wstring | std::basic_string<wchar_t> |
std::u16string | std::basic_string<char16_t> |
std::u32string | std::basic_string<char32_t> |
[modifica] Membri tipi
Membro tipo
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
traits_type
|
Traits
|
value_type
|
Traits::char_type
|
allocator_type
|
Allocator
|
size_type
|
Unsigned tipo integrale (di solito size_t)
Original: Unsigned integral type (usually size_t) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
difference_type
|
Signed integer type (usually ptrdiff_t) |
reference
|
Allocator::reference (C fino + 11)value_type& (dal C++11)
|
const_reference
|
Allocator::const_reference (C fino + 11)const value_type& (dal C++11)
|
pointer
|
Allocator::pointer (C fino + 11)std::allocator_traits<Allocator>::pointer (dal C++11) |
const_pointer
|
Allocator::const_pointer (C fino + 11) std::allocator_traits<Allocator>::const_pointer (dal C++11) |
iterator
|
RandomAccessIterator
|
const_iterator
|
Costante iteratore ad accesso casuale
Original: Constant random access iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
reverse_iterator
|
std::reverse_iterator<iterator> |
const_reverse_iterator
|
std::reverse_iterator<const_iterator> |
[modifica] Membri funzioni
costruisce un basic_string Original: constructs a basic_string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
assegna valori alla stringa Original: assigns values to the string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
assegnare i caratteri in una stringa Original: assign characters to a string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
restituisce l'allocatore associato Original: returns the associated allocator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
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. | |
accedere a carattere specificato con verifica dei limiti Original: access specified character with bounds checking The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
accedere a carattere specificato Original: access specified character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
(C++11) |
accede al primo carattere Original: accesses the first character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) |
(C++11) |
accede l'ultimo carattere Original: accesses the last character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) |
restituisce un puntatore al primo carattere di una stringa Original: returns a pointer to the first character of a string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
restituisce un valore non modificabile versione standard C matrice di carattere della stringa Original: returns a non-modifiable standard C character array version 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. (membro pubblico funzione) | |
Original: Iterators The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
(C++11) |
restituisce un iteratore all'inizio Original: returns an iterator to the beginning The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) |
(C++11) |
restituisce un iteratore fino alla fine Original: returns an iterator 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. (membro pubblico funzione) |
(C++11) |
restituisce un iteratore inverso all'inizio Original: returns a reverse iterator to the beginning The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) |
(C++11) |
restituisce un iteratore inverso alla fine Original: returns a reverse iterator 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. (membro pubblico funzione) |
Original: Capacity The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
controlla se la stringa è vuota Original: checks whether the string is empty The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
returns the number of characters (membro pubblico funzione) | |
restituisce il numero massimo di caratteri Original: returns the maximum number of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
riserve di stoccaggio Original: reserves storage The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
restituisce il numero di caratteri che possono essere tenuti in deposito attualmente assegnate Original: returns the number of characters that can be held in currently allocated storage The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
(C++11) |
riduce l'utilizzo della memoria da liberare la memoria inutilizzata Original: reduces memory usage by freeing unused memory The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) |
Original: Operations The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
cancella il contenuto Original: clears the contents The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
Inserti caratteri Original: inserts characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
removes characters (membro pubblico funzione) | |
aggiunge un carattere alla fine 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. (membro pubblico funzione) | |
(C++11) |
rimuove l'ultimo carattere Original: removes the last character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) |
aggiunge caratteri alla fine 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. (membro pubblico funzione) | |
aggiunge caratteri alla fine 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. (membro pubblico funzione) | |
confronta due stringhe Original: compares two strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
sostituisce ogni occorrenza di caratteri specificati Original: replaces every occurrence of specified characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
restituisce una sottostringa Original: returns a substring The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
copie caratteri Original: copies characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
cambia il numero di caratteri memorizzati Original: changes the number of characters stored The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
swap il contenuto Original: swaps the contents The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
Original: Search The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
individuare caratteri della stringa Original: find characters in the string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
trovare l'ultima occorrenza di una sottostringa Original: find the last occurrence of a substring The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
trovare prima occorrenza di caratteri Original: find first occurrence of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
trovare prima assenza di caratteri Original: find first absence of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
trovare ultima occorrenza di caratteri Original: find last occurrence of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
trovare assenza ultima di caratteri Original: find last absence of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico funzione) | |
Original: Constants The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
[statico] |
valore speciale. Il significato esatto dipende dal contesto Original: special value. The exact meaning depends on the context The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (pubblico membro statico costante) |
[modifica] Non membri funzioni
concatena due stringhe o una stringa e un carattere Original: concatenates two strings or a string and a char The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione di modello) | |
confronta lessicograficamente due stringhe Original: lexicographically compares two strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione di modello) | |
specializzata l'algoritmo std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione di modello) | |
Original: Input/output The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
esegue flusso di I / O sulle stringhe Original: performs stream I/O on strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione di modello) | |
leggere i dati da un I / O corrente in una stringa Original: read data from an I/O stream into a string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) | |
Original: Numeric conversions 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) |
converte una stringa in un numero intero con segno Original: converts a string to an signed integer The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) |
(C++11) (C++11) |
converte una stringa in un numero intero senza segno Original: converts a string to an unsigned integer The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) |
(C++11) (C++11) (C++11) |
converte una stringa in un valore in virgola mobile Original: converts a string to an floating point value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) |
(C++11) |
converte un valore in virgola mobile a integrale o string Original: converts an integral or floating point value to string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) |
(C++11) |
converte un valore in virgola mobile a integrale o wstring Original: converts an integral or floating point value to wstring The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) |
[modifica] Helper classi
(C++11) (C++11) (C++11) (C++11) |
sostegno hash per stringhe Original: hash support for strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe modello di specializzazione) |