The main difficulty is that operator[] doesn't return a bool, but rather it returns some reference type that's convertible to a bool.
So if you do something like bool& begin = &vector[0]; bool& next = begin + 1;
That wouldn't work. I'm not even sure if that's a compilation error or if it just does the wrong thing. Vector<bool> is so cursed I do my best to never use it, but as a consequence I'm also not too familiar with it's details.
You can still use iterators though to iterate over the vector<bool>.
View all comments
Show parent comment
8
u/Abadabadon 14d ago
Oh damn really? So you couldn't do a pointer++ traversal across it?