bitset操作函数具体实现
1 #include<iostream>
2 #include<cstdio>
3 #include<cstdlib>
4 #include<cstring>
5 #include<cmath>
6 #include<algorithm>
7 #include<bitset>
8 using namespace std;
9 const int maxn=16;
10
11 int main()
12 {
13     bitset<16> b2;
14     cout<<"b2.any() = "<<b2.any()<<endl;
15     cout<<"b2.none()= "<<b2.none()<<endl;
16     cout<<"b2.size()= "<<b2.size()<<endl;
17     cout<<"b2[4]= "<<b2[4]<<endl;
18     cout<<"b2.test(4)= "<<b2.test(4)<<endl;
19     b2.set() ; cout<<endl;
20     cout<<"b2.any() = "<<b2.any()<<endl;
21     cout<<"b2.none()= "<<b2.none()<<endl;
22     cout<<"b2.size()= "<<b2.size()<<endl;
23     cout<<"b2[4]= "<<b2[4]<<endl;
24     cout<<"b2.test(4)= "<<b2.test(4)<<endl;
25     b2.reset() ; cout<<endl;
26     cout<<"b2.any() = "<<b2.any()<<endl;
27     cout<<"b2.none()= "<<b2.none()<<endl;
28     cout<<"b2.size()= "<<b2.size()<<endl;
29     cout<<"b2[4]= "<<b2[4]<<endl;
30     cout<<"b2.test(4)= "<<b2.test(4)<<endl;
31     b2.set(4) ; cout<<endl;
32     cout<<"b2[4]= "<<b2[4]<<endl;
33     cout<<"b2.test(4)= "<<b2.test(4)<<endl;
34     return 0;
35 }