std::vector<bool>
Aus cppreference.com
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <vector> | ||
template<class Allocator =std::allocator<bool>> class vector<bool, Allocator>; | ||
std::vector<bool> ist eine platzsparende Spezialisierung std::vector für die Art bool .
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.
Die Art, wie std::vector<bool> wird platzsparend (sowie, ob es überhaupt optimiert wird) ist die Umsetzung definiert. Eine mögliche Optimierung beinhaltet koaleszierende Vektorelemente so dass jedes Element ein einzelnes Bit anstelle eines Byte-Größe bool einnimmt .
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> verhält sich ähnlich wie std::vector, aber um Platz effizient sein, sie:
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.
- Nicht unbedingt ihre Daten in einem einzigen zusammenhängenden Stück Speicher .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. - Freilegt std::vector<bool>::reference als Verfahren zum Zugriff auf einzelne Bits .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. - Nicht std::allocator_traits::construct verwenden, um Bit-Werte zu konstruieren .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.
[Bearbeiten]Mitglied Typen
Mitglied Typ 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 | implementierungsabhängig |
difference_type | implementierungsabhängig Original: implementation-defined The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Proxy-Klasse, die einen Verweis auf ein einzelnes 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. (Klasse) | |
const_reference | bool |
pointer | Implementierung definiert Original: implementation-defined The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
const_pointer | Implementierung definiert Original: implementation-defined The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
iterator | Implementierung definiert Original: implementation-defined The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
const_iterator | Implementierung definiert Original: implementation-defined 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> |
[Bearbeiten]Member-Funktionen
konstruiert die vector (öffentliche Elementfunktion of std::vector ) | |
zerstört die vector (öffentliche Elementfunktion of std::vector ) | |
weist Werte auf den Behälter 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. (öffentliche Elementfunktion of std::vector ) | |
weist Werte auf den Behälter 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. (öffentliche Elementfunktion of std::vector ) | |
liefert den zugehörigen Allocator (öffentliche Elementfunktion of std::vector ) | |
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. | |
Zugriff auf angegebene Element mit Überprüfung von Grenzen 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. (öffentliche Elementfunktion of std::vector ) | |
Zugriff auf angegebene Element 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. (öffentliche Elementfunktion of std::vector ) | |
Zugriff auf das erste Element 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. (öffentliche Elementfunktion of std::vector ) | |
Zugriff auf das letzte Element (öffentliche Elementfunktion of std::vector ) | |
Original: Iterators The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
liefert einen Iterator an den Anfang 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. (öffentliche Elementfunktion of std::vector ) | |
liefert einen Iterator bis zum Ende 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. (öffentliche Elementfunktion of std::vector ) | |
gibt einen umgekehrten Iterator an den Anfang 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. (öffentliche Elementfunktion of std::vector ) | |
gibt einen umgekehrten Iterator bis zum Ende 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. (öffentliche Elementfunktion of std::vector ) | |
Original: Capacity The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
prüft, ob der Container leer ist 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. (öffentliche Elementfunktion of std::vector ) | |
liefert die Anzahl der Elemente 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. (öffentliche Elementfunktion of std::vector ) | |
gibt die maximal mögliche Anzahl von Elementen 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. (öffentliche Elementfunktion of std::vector ) | |
reserviert Speicher (öffentliche Elementfunktion of std::vector ) | |
gibt die Anzahl der Elemente, die in derzeit zugewiesenen Speicher gehalten werden kann 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. (öffentliche Elementfunktion of std::vector ) | |
Original: Modifiers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
löscht den Inhalt 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. (öffentliche Elementfunktion of std::vector ) | |
Elemente einfügen 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. (öffentliche Elementfunktion of std::vector ) | |
löscht Elemente 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. (öffentliche Elementfunktion of std::vector ) | |
fügt Elemente am Ende 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. (öffentliche Elementfunktion of std::vector ) | |
entfernt das letzte Element 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. (öffentliche Elementfunktion of std::vector ) | |
ändert die Anzahl der gespeicherten Elemente (öffentliche Elementfunktion of std::vector ) | |
tauscht die Inhalte 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. (öffentliche Elementfunktion of std::vector ) | |
vector<bool> ModifikatorenOriginal: 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 (öffentliche Elementfunktion) | |
[statisch] | Swaps zwei 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. (public static Elementfunktion) |
[Bearbeiten]Non-Member-Funktionen
lexikographischer Vergleich der Werte in vector (Funktions-Template) | |
spezialisiert die std::swap Algorithmus 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. (Funktions-Template) |
[Bearbeiten]Notes
Wenn die Größe des bitset bei der Kompilierung bekannt ist, kann std::bitset verwendet werden, die bietet einen umfangreicheren Satz von Member-Funktionen. Außerdem besteht boost::dynamic_bitset als Alternative zu
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.