bitset::operator>>
Posune bity bitset pravé určený počet pozic a výsledek vrátí v novém bitset.
bitset<N> operator>>(
size_t _Pos
) const;
Parametry
- _Pos
Počet pozic vpravo, bity bitset mají být posunuty.
Vrácená hodnota
Nové bitset, kdy bity byly posunuty doprava potřebný počet pozic ve vztahu k cílové bitset.
Příklad
// 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;
}
Požadavky
Záhlaví:<bitset>
Obor názvů: std