|
|
On Tue, 25 Mar 2008 17:34:14 +0100, 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.
Yes, but that specialisation is largely considered a mistake because it
breaks the interface associated with the generic std::vector. Also, there
is no actual requirement that the elements occupy a single bit each; this
is left up to the implementation.
There is std::bitset, but that does not use dynamic allocation.
--
FE
Post a reply to this message
|
|