Boost logo

Boost :

Subject: Re: [boost] [dynamic_bitset] Comparison operators without assertions
From: Peter Dimov (lists_at_[hidden])
Date: 2017-05-17 00:46:58


Edward Diener wrote:
> An alternative algorithm I have been considering is when the bit sizes are
> unequal is:
>
> a) The bits comprising the common length are the low order bits.
> b) If the bitset with the larger bit size has any 1 bit outside the bits
> comprising the common length, the smaller bit size is always < the larger
> bit size.
> c) Else do a bit-by-bit comparison for the bits comprising the common
> length going from the higher order bit to the lower order bit of just
> those bits.

Could also add

d) if still equal, the larger bit size > the smaller bit size.

This makes 000111 > 111 instead of equal, so that equality (which I presume
checks sizes) and equivalence match.


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