On 5/11/2017 12:24 AM, degski via Boost wrote:
On 11 May 2017 at 04:15, Edward Diener via Boost
wrote: On 5/10/2017 8:28 PM, Peter Bartlett via Boost wrote: Or do you mean to suggest that your second choice would compare the last min(N,M) bits from left to right to determine ordering rather than the current right to left ?
Seems to me that comparing bitsets of different sizes makes little 'sense', but, having said that, having an order (any) in bitsets of different size is the right thing to have, as it allows for putting those bitsets in std::(multi_)map/std::(multi_)set. The choice of Left/Right or Right/Left should I think be guided by what is the cheapest way to compare them, as the 'most significant (to the user) bits' might be on the left, on the right, in the middle or even on both ends. I would go for memcmp().
There is no reason to change the right-to-left order as the most significant bit is on the right. 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. This will eliminate the assert and, hopefully, will not break any backward compatibility as the assert itself should never have been expected in normal code. 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.
degski