std::vector<bool>
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. |
Elemento definito nell'header <vector> | ||
template<class Allocator =std::allocator<bool>> class vector<bool, Allocator>; | ||
std::vector<bool> è uno spazio-efficiente specializzazione di std::vector per il bool tipo.
Original:
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.
Il modo in cui è fatto std::vector<bool> spazio efficiente (così come se è ottimizzata a tutti) è definita attuazione. Un potenziale di ottimizzazione coinvolge elementi del vettore a coalescenza in modo tale che ogni elemento occupa un singolo bit invece di un byte di dimensioni bool.
Original:
The manner in which std::vector<bool> is made space efficient (as well as whether it is optimized at all) is implementation defined. One potential optimization involves coalescing vector elements such that each element occupies a single bit instead of a byte-sized bool.
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.
std::vector<bool> comporta in modo simile a std::vector, ma per essere efficiente dello spazio, esso:
Original:
std::vector<bool> behaves similarly to std::vector, but in order to be space efficient, it:
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.
- Non necessariamente archiviare i propri dati in un singolo blocco contiguo di memoria.Original:Does not necessarily store its data in a single contiguous chunk of memory.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Espone std::vector<bool>::reference come metodo di accesso singoli bit.Original:Exposes std::vector<bool>::reference as a method of accessing individual bits.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Non utilizza std::allocator_traits::construct per costruire valori di bit.Original:Does not use std::allocator_traits::construct to construct bit values.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[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 |
value_type | bool |
allocator_type | Allocator |
size_type | definito dall'implementazione |
difference_type | definito dall'implementazione |
classe proxy che rappresenta un riferimento a un singolo bool Original: proxy class representing a reference to a single bool The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) | |
const_reference | bool |
pointer | definito dall'implementazione |
const_pointer | definito dall'implementazione |
iterator | definito dall'implementazione |
const_iterator | definito dall'implementazione |
reverse_iterator | std::reverse_iterator<iterator> |
const_reverse_iterator | std::reverse_iterator<const_iterator> |
[modifica]Membri funzioni
costruisce il vector (metodo pubblico) | |
distrugge il vector (metodo pubblico) | |
assegna valori al contenitore Original: assigns values to the container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
assegna valori al contenitore Original: assigns values to the container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
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. (metodo pubblico) | |
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 elemento specificato con verifica dei limiti Original: access specified element 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. (metodo pubblico) | |
accedere elemento specificato Original: access specified element The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
accedere al primo elemento Original: access the first element The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
access the last element (metodo pubblico) | |
Original: Iterators The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
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. (metodo pubblico) | |
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. (metodo pubblico) | |
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. (metodo pubblico) | |
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. (metodo pubblico) | |
Original: Capacity The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
verifica se il contenitore è vuoto Original: checks whether the container is empty The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
restituisce il numero di elementi Original: returns the number of elements The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
restituisce il massimo numero possibile di elementi Original: returns the maximum possible number of elements The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
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. (metodo pubblico) | |
restituisce il numero di elementi che possono essere tenuti in deposito attualmente assegnate Original: returns the number of elements 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. (metodo pubblico) | |
Original: Modifiers 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. (metodo pubblico) | |
inserti di elementi Original: inserts elements The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
cancella elementi Original: erases elements The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
aggiunge elementi alla fine Original: adds elements 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. (metodo pubblico) | |
rimuove l'ultimo elemento Original: removes the last element The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
changes the number of elements stored (metodo pubblico) | |
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. (metodo pubblico) | |
vector<bool> modificatori specificiOriginal: vector<bool> specific modifiersThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
flips all the bits (metodo pubblico) | |
[statico] | Scambia due std::vector<bool>::reference sOriginal: swaps two std::vector<bool>::reference sThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico statico) |
[modifica]Non membri funzioni
lessicografico confronta i valori nella vector Original: lexicographically compares the values in the vector 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) |
[modifica]Note
Se la dimensione del bitset è noto al momento della compilazione, std::bitset può essere utilizzato, che offre un ricco insieme di funzioni membro. Inoltre, boost::dynamic_bitset esiste come alternativa alla
std::vector<bool>
.Original:
If the size of the bitset is known at compile time, std::bitset may be used, which offers a richer set of member functions. In addition, boost::dynamic_bitset exists as an alternative to
std::vector<bool>
.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.