I am looking for an off-the-shelf dynamic bit vector in C or C++ that I can use. Unfortunately for various reasons I cannot use the BoosT libraries at the moment. std:bitvector looks promising but it is templated so I cannot set the length of the bit vector dynamically. Can anyone advise? Thanks!
Share
You don’t have to put a dependency onto all of boost and its installation process just to use
dynamic_bitset. If the class suits your purposes, copy the source files for it specifically into your project tree and put it in a separate namespace called “boostcopy” (or something like that).On a similar note, I made my own resizable array class modeled after dynamic_bitset called “Nstate”, which you can template to an arbitrary radix and still get tight packing. Perhaps of interest:
http://hostilefork.com/nstate/