开发者

What consumes more storage space - boost::dynamic_bitset<> or raw storage?

开发者 https://www.devze.com 2023-03-09 00:00 出处:网络
I have a program storage optimization question. I have, let say 4096 \"knots\" stored in a: boost::dynamic_bitset<>

I have a program storage optimization question.

I have, let say 4096 "knots" stored in a:

  boost::dynamic_bitset<>

I am now considering refactoring my program and build a CKnot class which will contain a bool.

The question is what will consume more space:

Thanks


The bitset will be considerably smaller, as a bool in C++ must be at least a byte in size, whereas each bit in a bitset is exactly that, a bit.

0

精彩评论

暂无评论...
验证码 换一张
取 消