std::bitset::operator>,>>=(3)

NAME
std::bitset::operator>,>>= - std::bitset::operator>,>>=

Synopsis
   bitset operator<<( std::size_t pos ) const; (until
                        C++11)
                        (since
   bitset operator<<( std::size_t pos ) const C++11)
   noexcept; (until
                        C++23)
   constexpr bitset operator<<( std::size_t pos (since
   ) const noexcept; C++23)
   bitset& operator<<=( std::size_t pos ); (until
                        C++11)
                        (since
   bitset& operator<<=( std::size_t pos ) C++11)
   noexcept; (until
                        C++23)
   constexpr bitset& operator<<=( std::size_t (since
   pos ) noexcept; (1) C++23)
   bitset operator>>( std::size_t pos ) const; (until
                        C++11)
                        (since
   bitset operator>>( std::size_t pos ) const (2) C++11)
   noexcept; (until
                        C++23)
   constexpr bitset operator>>( std::size_t pos (since
   ) const noexcept; (3) C++23)
   bitset& operator>>=( std::size_t pos ); (until
                        C++11)
                        (since
   bitset& operator>>=( std::size_t pos ) (4) C++11)
   noexcept; (until
                        C++23)
   constexpr constexpr bitset& operator>>=( (since
   std::size_t pos ) noexcept; C++23)
   Performs binary shift left and binary shift right. Zeroes are shifted in.
   1-2) Performs binary shift left. The (2) version is destructive, i.e. performs the
   shift to the current object.
   3-4) Performs binary shift right. The (4) version is destructive, i.e. performs the
   shift to the current object.

Parameters
   pos - number of positions to shift the bits

Return value
   1,3) new bitset object containing the shifted bits
   2,4) *this

Example
// Run this code
 #include <iostream>
 #include <bitset>
 int main()
 {
     std::bitset<8> b{0b01110010};
     std::cout << b << " (initial value)\n";
     for (; b.any(); b >>= 1) {
         for (; !b.test(0); b >>= 1) {
         }
         std::cout << b << '\n';
     }
 }

Output:
 01110010 (initial value)
 00111001
 00000111
 00000011
 00000001

See also
   rotl computes the result of bitwise left-rotation
   (C++20) (function template)
   rotr computes the result of bitwise right-rotation
   (C++20) (function template)
   operator&=
   operator|= performs binary AND, OR, XOR and NOT
   operator^= (public member function)
   operator~