std::vector<bool>
De cppreference.com
![]() | Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate. La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
Definido en el archivo de encabezado <vector> | ||
template<class Allocator =std::allocator<bool>> class vector<bool, Allocator>; | ||
std::vector<bool> es una especialización eficiente con el espacio de std::vector para la 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.
La manera en que se hace std::vector<bool> eficiente del espacio (así como si está optimizado en todos) de la implementación. Una optimización potencial implica coalescentes elementos del vector de manera que cada elemento ocupa un único bit en vez de un bool de tamaño de byte .
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 de manera similar a std::vector, pero con el fin de ser eficiente en espacio, que:
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.
- No necesariamente almacenar sus datos en un único trozo contiguo de 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. - Expone std::vector<bool>::reference como un método de acceso a bits individuales .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. - No utiliza std::allocator_traits::construct para construir valores de 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.
[editar]Tipos de miembros
Miembro de 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 | Definido por la implementación |
difference_type | Definido por la implementación |
clase de proxy que representa una referencia a una sola 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. (clase) | |
const_reference | bool |
pointer | Definido por la implementación |
const_pointer | Definido por la implementación |
iterator | Definido por la implementación |
const_iterator | Definido por la implementación |
reverse_iterator | std::reverse_iterator<iterator> |
const_reverse_iterator | std::reverse_iterator<const_iterator> |
[editar]Las funciones miembro
Construye el contenedor vector . (función miembro pública de std::vector<T,Allocator> ) | |
Destruye el contenedor vector . (función miembro pública de std::vector<T,Allocator> ) | |
Asigna valores al contenedor. (función miembro pública de std::vector<T,Allocator> ) | |
Asigna valores al contenedor. (función miembro pública de std::vector<T,Allocator> ) | |
Devuelve el asignador de memoria asociado. (función miembro pública de std::vector<T,Allocator> ) | |
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. | |
Accede al elemento especificado con comprobación de límites. (función miembro pública de std::vector<T,Allocator> ) | |
Accede el elemento especificado. (función miembro pública de std::vector<T,Allocator> ) | |
Accede al primer elemento. (función miembro pública de std::vector<T,Allocator> ) | |
Accede al último elemento. (función miembro pública de std::vector<T,Allocator> ) | |
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) | Devuelve un iterador al principio. (función miembro pública de std::vector<T,Allocator> ) |
(C++11) | Devuelve un iterador al final. (función miembro pública de std::vector<T,Allocator> ) |
(C++11) | Devuelve un iterador inverso al principio. (función miembro pública de std::vector<T,Allocator> ) |
(C++11) | Devuelve un iterador inverso al final. (función miembro pública de std::vector<T,Allocator> ) |
Original: Capacity The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
Comprueba si el contenedor está vacío. (función miembro pública de std::vector<T,Allocator> ) | |
Devuelve el número de elementos. (función miembro pública de std::vector<T,Allocator> ) | |
Devuelve el número máximo posible de elementos. (función miembro pública de std::vector<T,Allocator> ) | |
Reserva almacenamiento. (función miembro pública de std::vector<T,Allocator> ) | |
Devuelve el número de elementos que se pueden almacenar en el almacenamiento asignado actualmente. (función miembro pública de std::vector<T,Allocator> ) | |
Original: Modifiers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
Borra el contenido. (función miembro pública de std::vector<T,Allocator> ) | |
Inserta elementos (función miembro pública de std::vector<T,Allocator> ) | |
Borra elementos (función miembro pública de std::vector<T,Allocator> ) | |
Agrega elementos al final. (función miembro pública de std::vector<T,Allocator> ) | |
Remueve el último elemento. (función miembro pública de std::vector<T,Allocator> ) | |
Cambia el número de elementos almacenados. (función miembro pública de std::vector<T,Allocator> ) | |
Intercambia el contenido. (función miembro pública de std::vector<T,Allocator> ) | |
vector<bool> modificadores específicosOriginal: 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 (función miembro pública) | |
[estático] | swaps dos 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. (función miembro estática pública) |
[editar]Terceros funciones
(eliminado en C++20)(eliminado en C++20)(eliminado en C++20)(eliminado en C++20)(eliminado en C++20)(C++20) | Compara lexicográficamente los valores de vector. (plantilla de función) |
Especializa el algoritmo std::swap. (plantilla de función) |
[editar]Notas
Si el tamaño de la bitset es conocido en tiempo de compilación, std::bitset se puede utilizar, que ofrece un conjunto más rico de funciones miembro. Además, boost::dynamic_bitset existe como una alternativa a
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.