Espaces de noms
Variantes
Affichages
Actions

std::bitset::operator<<,<<=,>>,>>=

De cppreference.com
< cpp‎ | utility‎ | bitset

 
 
 
std::bitset
Types de membres
Original:
Member types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::reference
Les fonctions membres
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::bitset
bitset::operator==
bitset::operator!=
Elément d'accès
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::operator[]
bitset::test
bitset::all
bitset::any
bitset::none
(C++11)

 
bitset::count
Capacité
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::size
Modificateurs
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::operator&=
bitset::operator|=
bitset::operator^=
bitset::operator~
bitset::operator<<=
bitset::operator>>=
bitset::operator<<
bitset::operator>>
bitset::set
bitset::reset
bitset::flip
Conversions
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bitset::to_string
bitset::to_ulong
bitset::to_ullong (C++11)
Tiers fonctions
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator&
operator|
operator^
operator<<
operator>>
Classes d'aide
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::hash (C++11)
 
bitset<N> operator<<( size_t pos ) const;
(1)
bitset<N>& operator<<=( size_t pos );
(2)
bitset<N> operator>>( size_t pos ) const;
(3)
bitset<N>& operator>>=( size_t pos );
(4)

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.

Sommaire

[modifier] Paramètres

pos - number of positions to shift the bits

[modifier] Retourne la valeur

1,3) new bitset object containing the shifted bits

2,4) *this

[modifier] Exemple

#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;
    }
}

Résultat :

initial value: 01110010
00111001
00000111
00000011
00000001

[modifier] Voir aussi

effectue binaire AND, OR, XOR et NOT
Original:
performs binary AND, OR, XOR and NOT
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]