I need to store bits in files and std::bitset
would be perfect for this, because I need many of its operations when I read the structure back again. The class seems to consist of just an array of the bits and no other member data.
So instead of this
BYTE minuteOfDay[(60 * 24 / CHAR_BIT) + ((60 * 24 % CHAR_BIT) ? 1 : 0)];
I could have this:
std::bitset<60 * 24> minuteOfDay;
If the class should change with a future Visual Studio release and I need to read files written with an old version, I guess I could still just copy the old <bitset>
header into my project.
But just before making a really stupid decision: Is this idea somehow flawed for a reason I don't foresee right now?