Espacios de nombres
Variantes
Acciones

std::bitset::bitset

De cppreference.com
< cpp‎ | utility‎ | bitset

 
 
Utilidades de la biblioteca
Escriba apoyo (basic types, RTTI, type traits)
Gestión de memoria dinámica
Gestión de errores
Programa de servicios públicos
Funciones variadic
Fecha y hora
Objetos Function
initializer_list(C++11)
bitset
hash(C++11)
Operadores relacionales
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Pares y tuplas
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
Cambiar, hacia adelante y mover
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
std::bitset
Tipos de miembros
Original:
Member types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::reference
Las funciones miembro
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.
bitset::bitset
bitset::operator==
bitset::operator!=
Elemento acceso
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.
bitset::operator[]
bitset::test
bitset::all
bitset::any
bitset::none
(C++11)

 
bitset::count
Capacidad
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::size
Modificadores
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::operator&=
bitset::operator|=
bitset::operator^=
bitset::operator~
bitset::operator<<=
bitset::operator>>=
bitset::operator<<
bitset::operator>>
bitset::set
bitset::reset
bitset::flip
Conversiones
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::to_string
bitset::to_ulong
bitset::to_ullong(C++11)
Terceros funciones
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>>
Clases de ayuda
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.
std::hash(C++11)
 
constexpr bitset() noexcept;
(1)
constexpr bitset( unsigned long long val ) noexcept;
(2)
template< class CharT, class Traits, class Allocator >

explicit bitset( const std::basic_string<CharT,Traits,Allocator>& str,
                 typename std::basic_string<CharT,Traits,Allocator>::size_type pos = 0,
                 typename std::basic_string<CharT,Traits,Allocator>::size_type n =
                     std::basic_string<CharT,Traits,Allocator>::npos);

         bitset( const std::basic_string<CharT,Traits,Allocator>& str,
                 typename std::basic_string<CharT,Traits,Allocator>::size_type pos = 0,
                 typename std::basic_string<CharT,Traits,Allocator>::size_type n =
                     std::basic_string<CharT,Traits,Allocator>::npos,
                 CharT zero = CharT(0),

                 CharT one = CharT(1));
(3) (hasta C++11)



(desde C++11)
template< class CharT >

explicit bitset( const CharT* str,
                 typename std::basic_string<CharT>::size_type n =
                     std::basic_string<CharT>::npos,
                 CharT zero = CharT(0),

                 CharT one = CharT(1));
(4) (desde C++11)
Construye un nuevo bitset de una de varias fuentes de datos opcionales:
Original:
Constructs a new bitset from one of several optional data sources:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1. Por defecto constructor. Construye un bitset con todos los bits a cero .
Original:
1. Default constructor. Constructs a bitset with all bits set to zero.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2. Construye un bitset usando los bits en val. Si el N es el tamaño de la bitset y M es el número de bits establecidos en val, entonces sólo min (N, M) bits se incluyen en la bitset .
Original:
2. Constructs a bitset using the bits in val. If the N is the size of the bitset and M is the number of set bits in val, then only min(N, M) bits will be included in the bitset.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3. Construye un bitset con los personajes de la std::basic_string str. Un opcional pos la posición inicial y n longitud se puede proporcionar, así como los caracteres que denotan valores alternativos para set (one) y unset (zero) bits .
Original:
3. Constructs a bitset using the characters in the std::basic_string str. An optional starting position pos and length n can be provided, as well as characters denoting alternate values for set (one) and unset (zero) bits.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
La longitud efectiva de la cadena de inicialización es min (n, str.size() - pos) .
Original:
The effective length of the initializing string is min(n, str.size() - pos).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si pos > str.size(), este constructor lanza std::out_of_range. Si hay caracteres examinados en str no se zero o one, lanza std::invalid_argument .
Original:
If pos > str.size(), this constructor throws std::out_of_range. If any characters examined in str are not zero or one, it throws std::invalid_argument.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4. Similar a (3), pero utiliza un CharT* en lugar de un std::basic_string .
Original:
4. Similar to (3), but uses a CharT* instead of a std::basic_string.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Contenido

[editar] Parámetros

val -
número que se utiliza para inicializar el bitset
Original:
number used to initialize the bitset
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
str -
cadena que se utiliza para inicializar el bitset
Original:
string used to initialize the bitset
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pos -
un desplazamiento inicial en str
Original:
a starting offset into str
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
n -
número de caracteres que se utilizan desde str
Original:
number of characters to use from str
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
one -
carácter alternativo de bits puestos en str
Original:
alternate character for set bits in str
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
zero -
carácter alternativo para los bits no definidas en str
Original:
alternate character for unset bits in str
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Excepciones

1. ninguno
Original:
1. none
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2. ninguno
Original:
2. none
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

3. std::out_of_range if pos > str.size()

4. ninguno
Original:
4. none
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


[editar] Ejemplo

#include <bitset>
#include <string>
 
int main() 
{
    // empty constructor
    std::bitset<8> b1; // [0,0,0,0,0,0,0,0]
 
    // unsigned long long constructor
    std::bitset<8> b2(42); // [0,0,1,0,1,0,1,0]
 
    // string constructor
    std::string bit_string = "110010";
    std::bitset<8> b3(bit_string);       // [0,0,1,1,0,0,1,0]
    std::bitset<8> b4(bit_string, 2);    // [0,0,0,0,0,0,1,0]
    std::bitset<8> b5(bit_string, 2, 3); // [0,0,0,0,0,0,0,1]
 
    // string constructor using custom zero/one digits
    std::string alpha_bit_string = "aBaaBBaB";
    std::bitset<8> b6(alpha_bit_string, 0, alpha_bit_string.size(),
                      'a', 'B');         // [0,1,0,0,1,1,0,1]
 
    // char* constructor using custom digits
    std::bitset<8> b7("XXXXYYYY", 0, 'X', 'Y'); // [0,0,0,0,1,1,1,1]
    return 0;
}


[editar] Ver también

sets bits to true or given value
(miembro público función) [edit]
establece bits a false
Original:
sets bits to false
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro público función) [edit]