//不考虑溢出 相当于 ++bs
//如果溢出,bs不改变
template<size_t _Nb>
bitset<_Nb> & add1(bitset<_Nb> &bs){
int i=0, n=bs.size();
for(; i<n; i++){
if(bs[i]==0){
bs[i]=1;
break;
}
else if(bs[i]==1){
bs[i]=0;
}
}
return bs;
}
实现bitset自增
猜你喜欢
转载自blog.csdn.net/wx_assa/article/details/108586728
今日推荐
周排行