返回位的数目。bitset 对象。
size_t size( ) const;
返回值
位的数目,N,bitset<">。
示例
在编译此示例与 /Wp64 标志或在 64 位平台时,编译器将生成警告 C4267。 有关该警告的更多信息,请参见 编译器警告(等级 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;
}
要求
页眉: <bitset>
命名空间: std