public member function
<bitset>
std::bitset::flip all bits (1)bitset& flip();single bit (2)
bitset& flip (size_t pos);all bits (1)
bitset& flip() noexcept;single bit (2)
bitset& flip (size_t pos);
Flip bits
Flips bit values converting zeros into ones and ones into zeros:0
.
*this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// bitset::flip
#include <iostream> // std::cout
#include <string> // std::string
#include <bitset> // std::bitset
int main ()
{
std::bitset<4> foo (std::string("0001"));
std::cout << foo.flip(2) << '\n'; // 0101
std::cout << foo.flip() << '\n'; // 1010
return 0;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4