Udostępnij za pośrednictwem


bitset::size

Zwraca liczbę bitów w obiekcie bitset.

size_t size( ) const;

Wartość zwracana

The number of bits, N, in a bitset<N>.

Przykład

Podczas kompilowania przykładzie z /Wp64 flagę lub na platformie 64-bitowe, zostanie wygenerowany kompilator ostrzeżenia C4267.Ostrzeżenie to uzyskać więcej informacji, zobacz Kompilator ostrzeżenia (poziom 3) C4267.

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

int main()
{
    using namespace std;

    bitset<5> b1(6);
    size_t i;

    cout << "The set of bits in bitset<5> b1( 6 ) is: ( "<< b1 << " )"
         << endl;

    i = b1.size();

    cout << "The number of bits in bitset b1 is: " << i << "."
         << endl;
}
  

Wymagania

Nagłówek: <bitset>

Obszar nazw: std

Zobacz też

Informacje

bitset Class