DFHack's BitArray<> class is a reimplementation of Toady's flagarrayst with a few additional features. However, it is not strictly compatible with it because it uses realloc() and free() to manage the flag data buffer, while Toady's version uses new unsigned char[] and delete[].
In practice, this "works" on all of our supported platforms, but tools such as valgrind rightfully complain that we're mixing memory management functions incorrectly.