STD :: BITSET重新亮相
std::bitset redeclaration
我想从我的bitset代表的数字中提取一个整数。但是,我不知道如何a)复制一个比特斯特,或者,b)重新构成bitset:
bitset<7> bits(5);
int newresult=bits.to_ulong();
newresult=newresult-1;
bits=bitset<7> tempbits(newresult); // of course doesn't work
重要的是,我的最终结果在 bits bitset中。如何正确执行?
bits = bitset<7>(newresult);
相关文章:
- 使用新行和不使用新行读取文件
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 在C++中,是否可以基于给定的标识符创建基类的新实例,反之亦然
- 遇到新行时,有没有办法停止istream_iterator
- Constexpr替代了新的放置方式,可以让内存中的对象保持未初始化状态
- 当一个新对象被分配到它的地址时,对象是否必须被销毁
- 模板元编程:如何将参数包组合成新的参数包
- 使用不同的CRT将新的C++代码与旧的(二进制)组件隔离开来的最佳方法是什么
- 如何使用CLion在Mac上创建一个新的.txt文件
- 错误-我无法在VS2019中打开新的Qt项目
- 有没有比在库中添加一个并非由所有派生类实现的新虚拟函数更好的设计实践
- 为什么新的随机库比std::rand()更好
- 在cygwin中测试新的boost安装时出现cpp错误
- C++:继续创建新的变量可以吗
- Qt:当QListView获得新条目时,如何更新QStringList
- 为C++03编译器编写部分unique_ptr,该编译器与较新的编译器在公共代码库上运行
- c++20[[no.unique_address]]中的新功能是什么
- 将指针类分配给新类,C++
- 如何使用新运算符跟踪在循环中创建的 QLabel
- STD :: BITSET重新亮相