Alternative design to D81580 with the following change in API
using Bool = Bitfield<bool, 0, 1>; // testField becomes cast to bool operator before: if(Bool::testField(Storage)) after: if(bitfield<Bool>(Storage).isSet()) // getField becomes cast to UserType before: auto Value = Bool::getField(Storage); after: auto Value = bitfield<Bool>(Storage); // setField becomes returning a UserType assignable object before: Bool::setField(Storage, Value); after: bitfield<Bool>(Storage) = Value;
The conversion from/to enum/bool are done in the public API outside of this template where is that ?