Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 C++ boost 的 dynamic_bitset。
我已经分配了一个变量,我只想更改它的值 - 从构造函数中的“unsigned long”重新构造它,但我不想再次分配内存或创建临时变量。
我能做些什么?
我想你可以清除它,然后附加新值:
long x, y; boost::dynamic_bitset<> bs(sizeof(long)*8, x); bs.clear(); bs.append(y);