bitset::operator>>

Desplaza los bits de un bitset a la derecha el número especificado de posiciones y devuelve el resultado a un nuevo bitset.

bitset<N> operator>>(
   size_t _Pos
) const;

Parámetros

  • _Pos
    El número de posiciones a la derecha los bits del bitset debe desplazar.

Valor devuelto

Un nuevo bitset donde los bits se han movido a la derecha el número necesario de posiciones en relación con el bitset concreto.

Ejemplo

// bitset_op_RS.cpp
// compile with: /EHsc
#include <bitset>
#include <iostream>

int main( )
{
   using namespace std;
   bitset<5> b1 ( 7 );
   cout << "The bitset b1 is: ( "<< b1 << " )." << endl;

   bitset<5> b2;
   b2 = b1 << 2;

   cout << "After shifting the bits 2 positions to the left,\n"
        << " the bitset b2 is: ( "<< b2 << " )."
        << endl;
   bitset<5> b3 = b2 >> 1;

   cout << "After shifting the bits 1 position to the right,\n"
        << " the bitset b3 is: ( " << b3 << " )."
        << endl;
}
  
  
  

Requisitos

encabezado: <bitset>

espacio de nombres: std

Vea también

Referencia

bitset Class