|
|
|
|
|
by andrepd
181 days ago
|
|
> C++ has std::bitset and std::vector Notably, this is not the case. C++ std::vector is specialised for bools to pack bits into words, causing an untold array (heh) of headaches. And "wasteful" is doing a lot of lifting here. In terms of memory usage? Yes. In terms of CPU? The other way around. |
|
That depends on your architecture and access pattern. In case of sequential access, packed bools may perform better due to arithmetic being usually way cheaper than memory operations.