std::bitset::all, std::bitset::any, std::bitset::none
Da 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. |
bool all() const; |
(desde C++11) | |
bool any() const; |
||
bool none() const; |
||
Verifica se todos, alguns ou nenhum dos bits são definidos como true.
1) Original:
Checks if all, any or none of the bits are set to true.
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.
Verifica se todos os bits são definidos como true
2) Original:
Checks if all bits are set to true
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.
Verifica se os bits são definidos para true
3) Original:
Checks if any bits are set to true
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.
Verifica se nenhum dos bits são definidos como true
Original:
Checks if none of the bits are set to true
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.
[editar] Parâmetros
(Nenhum)
Original:
(none)
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.
[editar] Valor de retorno
1)true se todos os bits são definidos para true, caso contrário false
2) Original:
true if all bits are set to true, otherwise false
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.
true se qualquer um dos bits são definidos como true, caso contrário false
3) Original:
true if any of the bits are set to true, otherwise false
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.
true se nenhum dos bits são definidos como true, caso contrário false
Original:
true if none of the bits are set to true, otherwise false
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.
[editar] Exemplo
#include <iostream> #include <bitset> int main() { std::bitset<4> b1("0000"); std::bitset<4> b2("0101"); std::bitset<4> b3("1111"); std::cout << "bitset\t" << "all\t" << "any\t" << "none\n"; std::cout << b1 << '\t' << b1.all() << '\t' << b1.any() << '\t' << b1.none() << '\n'; std::cout << b2 << '\t' << b2.all() << '\t' << b2.any() << '\t' << b2.none() << '\n'; std::cout << b3 << '\t' << b3.all() << '\t' << b3.any() << '\t' << b3.none() << '\n'; }
Saída:
bitset all any none 0000 0 0 1 0101 0 1 0 1111 1 1 0