How get bool's from std::vector<bool>
I don't know how many people know this but a vector of bools is not a container. (see this: http://www.gotw.ca/publications/mill09.htm for more info)
I have a template'd function that works for everything except a vector of bools (again read the article to see why).
So my question is: what's the best way to get the data from a vector of bools? Is the only way to loop through it and do it one item at a time?
//My function is essentially like this
void f( T& t )
//Neither of these two statements work with bool
typename T::value_type* p1 = &t;
typename T::value_type* p2 = &*t.begin();
// ... do something with *p1 and *p2 ...
but that didn't do anything (using g++ 3.4.5).