Reputation: 6150
I would like to substract an integer from a number that my bitset represents. However, I don't know how to either a) copy a bitset to another bitset, or, b) re-instantiate a bitset:
bitset<7> bits(5);
int newresult=bits.to_ulong();
newresult=newresult-1;
bits=bitset<7> tempbits(newresult); // of course doesn't work
It is important that my end result is in bits bitset. How to do it properly?
Upvotes: 0
Views: 140