Reputation: 11859
I am using C++ boost's dynamic_bitset.
I have already allocated a variable and I just want to change its value - to construct it anew from an 'unsigned long' like from the constructor, but I don't want to allocate the memory again or to create a temporary variable.
What can I do?
Upvotes: 1
Views: 386
Reputation: 41333
I suppose you could clear it and then append the new value:
long x, y;
boost::dynamic_bitset<> bs(sizeof(long)*8, x);
bs.clear();
bs.append(y);
Upvotes: 1