在C / C动态位向量++ [英] Dynamic bit vector in C/C++
问题描述
我要寻找一个在C或C ++场外现货动态比特矢量,我可以使用。遗憾的是由于种种原因,我不能在此刻使用Boost库。 STD:位向量看起来很有希望,但它是模板化,所以我不能设置位向量的长度动态。谁能指教?谢谢!
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!
推荐答案
您不必把一个依赖关系到所有升压和其安装过程只用来,dynamic_bitset
。如果类适合你的目的,它的源文件复制到具体项目树,并把它称为boostcopy(或类似的东西)。
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).
在一个类似的说明,我做我自己的可调整大小的数组类来,dynamic_bitset称为NSTATE,您可以模板任意的基数,仍然可以得到紧密堆积蓝本。也许是利益:
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/
这篇关于在C / C动态位向量++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!