Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ STL vector<bool> et. al.



Jerry Feldman <gaf at blu.org> writes:

> In the code I'm hacking they have a home grown boolean array. One example 
> is that it has a boolean array of business days, holidays and a few 
> others. Rather than use the existing class I am somewhat leaning toward 
> replacing the boolean array class with either std::vector<bool> or std::bitset. 
> Note that the original code I am porting contained its own string, array, 
> map and set classes, which I am replacing with either the STL or RogueWave 
> analogs to the STL. (What I'm doing is writing part of a new product, but 
> I need to preserve many of the classes.)

I'd recommend avoiding std::vector<bool> and using std::bitset or
deque<bool> instead.  std::vector<bool> isn't a true STL container,
and this might cause you some trouble.

Meyers' _Effective STL_ book discusses this in some detail.  Other
sources exist as well.

Regards,

--kevin
-- 
GnuPG ID: B280F24E              Never could stand that dog.
alumni.unh.edu!kdc                   -- Tom Waits


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org