bitset<N> operator<<( std::size_t pos ) const; | (1) | |
bitset<N>& operator<<=( std::size_t pos ); | (2) | |
bitset<N> operator>>( std::size_t pos ) const; | (3) | |
bitset<N>& operator>>=( std::size_t pos ); | (4) |
Performs binary shift left and binary shift right. Zeroes are shifted in.
pos | - | number of positions to shift the bits |
*this
(none) | (until C++11) |
noexcept specification: noexcept | (since C++11) |
#include <iostream> #include <bitset> int main() { std::bitset<8> b("01110010"); std::cout << "initial value: " << b << '\n'; while (b.any()) { while (!b.test(0)) { b >>= 1; } std::cout << b << '\n'; b >>= 1; } }
Output:
initial value: 01110010 00111001 00000111 00000011 00000001
performs binary AND, OR, XOR and NOT (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/bitset/operator_ltltgtgt