If I want a compile-time-sized bit-array (on stack) what are my alternatives?
I'm thinking something like
struct Bitset(size_t nBits) {
enum wsz = 8 * size_t.sizeof; // Word-Size.
enum nBlocks = nBits/wsz + nBits % wsz * wsz;
alias _bits this;
size_t[nBlocks] _bits;
}
along with bt
and alikes from core.bitop
would suit my needs.
Has anybody already written a template for this along with some nice boolean operations?
I would simply check if BitArray uses the stack or not. If not, grab the source code and modify it...
IMHO BitArray could be improved with some sort of option whether you want it on the stack or not...