S
Scott Brady Drummonds
Hi, everyone,
I have a program in which I need to store a series of Boolean values. A
vector<bool> would be ideal. However, I'm concerned about this data
structure because of Scott Meyers' Effective STL's Item 18: Avoid using
vector<bool>.
Plus, I'm loath to use bit_vector since SGI's STL implementation says it
will soon be dropped on the floor
(http://www.sgi.com/tech/stl/bit_vector.html).
Additionally, the bitset won't work because I don't know the number of
values I'll need at compile time. Lastly, Meyers' recommendation of using a
dequeue<bool> scares me a little because it appears that it won't pack the
sequence of bools into bits the way that a bitset does (and, frankly, the
way I'd like my data structure to do since there may be a lot of flags in
this container.)
What is the best way to compactly store a sequence of on/off flags and allow
for indexed addressing?
Thanks,
Scott
I have a program in which I need to store a series of Boolean values. A
vector<bool> would be ideal. However, I'm concerned about this data
structure because of Scott Meyers' Effective STL's Item 18: Avoid using
vector<bool>.
Plus, I'm loath to use bit_vector since SGI's STL implementation says it
will soon be dropped on the floor
(http://www.sgi.com/tech/stl/bit_vector.html).
Additionally, the bitset won't work because I don't know the number of
values I'll need at compile time. Lastly, Meyers' recommendation of using a
dequeue<bool> scares me a little because it appears that it won't pack the
sequence of bools into bits the way that a bitset does (and, frankly, the
way I'd like my data structure to do since there may be a lot of flags in
this container.)
What is the best way to compactly store a sequence of on/off flags and allow
for indexed addressing?
Thanks,
Scott