Gu**********@gmail.com wrote:
Is there any good reason operator< is not defined for std::bitset?
I would venture a guess that a bitset was created as a collection of
*independent* bits none of which is more important than the other, and
therefore the type does not have the semantics of comparison with 'less
than' operators, only for equality.
It
seems to me that:
1 - it would be useful.
That's exactly on what the creators of the library do not agree with
you, I am guessing. You seem to attach some extra meaning to those
bits, the meaning the creators did not want to give the elements of the
collection.
2 - it is easy to implement inside the class template.
3 - it is impossible to implement efficiently (for bitsets too large
for to_ulong) outside of the class.
For now I will use boost::dynamic_bitset, which does implement it.
That's what the third-party libraries are for, extending the standard
library, providing elements that do not exist in it.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask