C++教程
C++控制语句
C++函数
C++数组
C++指针
C++对象
C++继承
C++多态
C++抽象
C++常用
C++ STL教程
C++迭代器
C++程序

C++ bitset all()

C++ bitset all()函数

C++ bitset all()函数用于测试是否设置了bitset中的所有位。它返回一个布尔值,即true或false。

语法

bool all() const no except; 

参数

不带任何参数。

返回值

它返回布尔值

示例1

#include <iostream>
#include <bitset>
using namespace std;
int main()
{
bitset<4> b;
bitset<4> mask("1111");
if (!b.all())
cout<< "All bits are not set." <<endl;
b |= mask;
if (b.all())
cout<< "All bit are set." <<endl;
return 0;
} 
输出:
All bits are not set.
All bit are set. 
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4