<div class="t-tr-text">C + +: conceitos<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">C++ concepts:</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> BitmaskType
De cppreference.com
<metanoindex/>
Define um tipo que pode ser usado para representar um conjunto de valores constantes ou qualquer combinação desses valores. Esta característica é normalmente implementada por tipos inteiros, std::bitset, ou enumerações (escopo e sem escopo) com sobrecargas de operador adicionais.
Original:
Defines a type that can be used to represent a set of constant values or any combination of those values. This trait is typically implemented by integer types, std::bitset, or enumerations (scoped and unscoped) with additional operator overloads.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Requisitos
O tipo de máscara de bits suporta um número finito de elementos bitmask, que são valores distintos do tipo máscara de bits, de modo que, para qualquer par Ci e Cj, Ci & Ci != 0 e Ci & Cj == 0.
Original:
The bitmask type supports a finite number of bitmask elements, which are distinct values of the bitmask type, such that, for any pair Ci and Cj, Ci & Ci != 0 and Ci & Cj == 0.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Os operadores bit a bit operator&, operator|, operator^, operator~, operator&=, operator|=, e operator^= são definidas para valores do tipo de máscara de bits e têm a mesma semântica que os correspondentes operadores internos sobre inteiros sem sinal teria se os elementos foram bitmask o inteiro distinta potências de dois.
Original:
The bitwise operators operator&, operator|, operator^, operator~, operator&=, operator|=, and operator^= are defined for values of the bitmask type and have the same semantics as the corresponding built-in operators on unsigned integers would have if the bitmask elements were the distinct integer powers of two.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
As seguintes expressões são bem formados e têm o seguinte significado em qualquer X. BitsetType
Original:
The following expressions are well-formed and have the following meaning for any BitsetType X
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
X |= Y
|
define o valor de Y no objeto Original: sets the value Y in the object X The text has been machine-translated via Google Translate. |
X &= ~Y
|
X.. limpa o valor Y no X. objeto Original: clears the value Y in the object X The text has been machine-translated via Google Translate. |
X&Y != 0
|
Y indica que o valor é definido no objeto X Original: indicates that the value Y is set in the object X The text has been machine-translated via Google Translate. |
Cada elemento de máscara de bits representible é definida como um valor do tipo constexpr bitmask.
Original:
Each representible bitmask element is defined as a constexpr value of the bitmask type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Uso
Os seguintes tipos de biblioteca padrão satisfazer BitmaskType:
Original:
The following standard library types satisfy BitmaskType:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- std::ctype_base::mask
- std::ios_base::fmtflags
- std::ios_base::iostate
- std::ios_base::openmode
std::regex_traits::char_class_type- std::regex_constants::syntax_option_type
- std::regex_constants::match_flag_type
- std::launch,
O código que se baseia em algumas opção de implementação particular (por exemplo int n = std::ios_base::hex), é porque não portável std::ios_base::fmtflags não é necessariamente implicitamente conversível para int.
Original:
Code that relies on some particular implementation option (e.g. int n = std::ios_base::hex), is nonportable because std::ios_base::fmtflags is not necessarily implicitly convertible to int.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.