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]>

> 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.


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.


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

Boost list run by bdawes at, gregod at, cpdaniel at, john at