On 5/16/2017 2:49 AM, degski via Boost wrote:
On 15 May 2017 at 23:50, Edward Diener via Boost
wrote: What I have ended up doing is to keep the exact same behavior as before when the bitsets are of equal size. When the bitsets are of unequal size, if either size is 0 that bitset is less than the other one. If neither size is 0 I convert both bitsets to an unsigned long using the already provided member function to_ulong() and use those values for the comparison.
A throwing function returning a ulong seem wrong and restrictive (32 bits on windows). If my bitset was only 32 bits long, I wouldn't use a dynamic_bitset<> in the first place.
There is no other way to do it. BTW ulong is 64-bits on any 64-bit OS.
I found that it was completely wrong to do bit-by-bit comparisons when the
bitsets were not the same size.
Size/length could be the deciding factor in this case.
Feel free to suggest an algorithm which works doing bit-by-bit comparisons when the number of bits are different.
degski