C / C ++高效位阵列 [英] C/C++ efficient bit array

查看:112
本文介绍了C / C ++高效位阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能推荐高效/干净的方式来处理任意长度位阵列?
现在我使用普通INT /炭位掩码,但那些不是很干净,当数组长度超过数据类型的长度。

Can you recommend efficient/clean way to manipulate arbitrary length bit array? right now I am using regular int/char bitmask, but those are not very clean when array length is greater than datatype length.

STD矢量<布尔方式> 不适用于我

感谢

推荐答案

<一个href=\"http://www.boost.org/doc/libs/1_42_0/libs/dynamic_bitset/dynamic_bitset.html\"><$c$c>boost::dynamic_bitset如果长度在运行时只知道。

boost::dynamic_bitset if the length is only known in run time.

和std :: bitset 如果长度在编译时(尽管任意)称。

std::bitset if the length is known in compile time (although arbitrary).

这篇关于C / C ++高效位阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆