Boost logo

Boost :

Subject: Re: [boost] [dynamic_bitset] Comparison operators without assertions
From: degski (degski_at_[hidden])
Date: 2017-05-11 05:34:35


On 11 May 2017 at 08:11, Edward Diener via Boost <boost_at_[hidden]>
wrote:

> There is no reason to change the right-to-left order as the most
> significant bit is on the right.

A bitset is not a number, 'most signifcant' depends on usage and is in the
eye of the beholder.

> Furthermore it would be foolish to break backward compatibility on a whim.

 Yes.

I will probably keep the same order but just add that the longer size, the
> rest being equal, will always be considered greater than the shorter size.

One could introduce a comparison-policy, the default preserving the
'current' behaviour.

> The only other possibility that I can imagine, if the assert is
> eliminated, is to throw some exception if the sizes are not equal, which at
> least has the possibility of keeping the program running if the exception
> is caught.
>

An exception seems completely wrong to me, as there is a valid use case for
comparing bitsets of differing lengths. Exceptions should be used for
exceptional situations, i.e. not here.

degski

-- 
"*Ihre sogenannte Religion wirkt bloß wie ein Opiat reizend, betäubend,
Schmerzen aus Schwäche stillend.*" - Novalis 1798

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