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.



On Thu, 14 Dec 2006 16:19:44 -0500
kclark at elbrysnetworks.com (Kevin D. Clark) wrote:

> 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.

On Thu, 14 Dec 2006 16:12:18 -0500
Matthew Gillen <me at mattgillen.net> wrote:

> Don't use vector<bool>, at least not before you understand some of the issues
> with it.  This article explains some of the quirkiness:
> http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=98&rl=1

I'm aware of the quirkiness and other issues of vector<bool> which is
why I actually posted this. Additionally, it can cause performance
issues. 

> Replacing the other types (string, array, map, set) probably isn't as fraught
> with peril, and is unquestionably the right thing to do, unless the original
> had different memory management semantics than the STL (ie if the old code
> stored pointers to the object instead of copies of the object).
For the most part just about everything will translate to the STL
types. The reason for RogueWave is also the threadsafeness where the
Linux native implementation is not threadsafe. I've reasonably
experience with using the STL string, vector, map and set types. 


-- 
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9



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