P0237, Wording for fundamental bit manipulation utilities might appear in a near future (its current target is C++Next) and changes the way bits are seen:
- We should make sure that
bit_iterator works with gray_code.
- Instead of
bool, it might be better to use std::bit_value, not to confuse the logical type and the bit one.
std::binary_digits is designed to be specialized for user-defined types. We should take the opportunity to do so for gray_code:
There is still plenty of time anyway, but it might help to get a cleaner design in the end.