Nicolas Alvarez <nic### [at] gmailisthebestcom> wrote:
> C++ STL vector template class has a specialization for 'bool' that uses
> 1 bit per element too. That is, a vector<bool> takes 1 bit per element.
The C++ standard library also offers the 'bitset' data container which
is specifically optimized to handle bits. (Its disadvantage is that its
size must be determined at compile time, and this size cannot change,
unline with std::vector<bool>.)
Many operations doable to bitsets are extremely fast. (For example
counting the number of 1-bits is astonishingly fast.)
--
- Warp
Post a reply to this message
|