For practice, I tried making my own bitset. I noticed, that the STL bitset has two operator[] overloads, a const one that returns a bool, and a non const one that returns a reference object. I attempted to do the same thing, but only the one that returns a reference object seems to be called, even for something as simple as:
bool b = myBitset[3];
I was able to make a crude workaround by adding a bool cast operator to the reference object, but I would like to know how to properly implement both [] operators.
Also, I want to use a non-dynamic array in the structure, and be able to set this using the number of bits in a template, the problem is I don't know how to convert the bits to bytes without having it found dynamically, unless I do this funky thing: