ye who write c++, what is thine feelings about std::vector<bool>?
Poll
Voting ended 16 July at 16:40.
Top-level
ye who write c++, what is thine feelings about std::vector<bool>? Anonymous poll
Poll
yes i c++, vector<bool> rules
15
6.2%
yes i c++, vector<bool> sucks
87
36%
i don't c++, vector<bool> rules
14
5.8%
i don't c++, vector<bool> sucks
62
25.6%
wait vector<bool> is special?
242 people voted. 64
26.4%
Voting ended 16 July at 16:40. 5 comments
@streganil i think that's where i fall too, yeah. vector<bool> is relatively rare, so it won't come up much, but it's unfortunate that a desire to optimize the concrete case of vector<bool> made the whole vector type just a little less useful in generic contexts > a desire to optimize the concrete case And it wasn't even created as an optimization but for pedagogical purposes. > The vector<bool> specialization was intentionally put into the standard to provide an example of how to write a proxied container. |
for those who don't know: it's standard (required?) for C++'s std::vector<bool> to be specialized to actually bitpack the booleans, getting you 8x the booleans per allocated byte (nice!)
...at the cost of any API that returns T* or the like now being literally impossible to satisfy, silently deleting random APIs from the std::vector interface (oh no!)
aiui this makes code that generically works with vectors now randomly incompatible with that particular substitution (unless you very carefully avoid those APIs)
for those who don't know: it's standard (required?) for C++'s std::vector<bool> to be specialized to actually bitpack the booleans, getting you 8x the booleans per allocated byte (nice!)
...at the cost of any API that returns T* or the like now being literally impossible to satisfy, silently deleting random APIs from the std::vector interface (oh no!)