Boost logo

Boost :

Subject: Re: [boost] [dynamic_bitset] Comparison operators without assertions
From: Edward Diener (eldiener_at_[hidden])
Date: 2017-05-16 17:01:25


On 5/16/2017 2:49 AM, degski via Boost wrote:
> On 15 May 2017 at 23:50, Edward Diener via Boost <boost_at_[hidden]>
> 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
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk