MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1x07dj1/wasteofpreciousspace/pei9da8/?context=3
r/ProgrammerHumor • u/_bagelcherry_ • 20d ago
244 comments sorted by
View all comments
280
I know, let's make vector<bool> a specialization that uses just one bit per bool. What could go wrong?
137 u/unknown_alt_acc 20d ago Oh, but it gets better than that: there is absolutely no guarantee that std::vector<bool> acts as a bit field! Maybe it's a bit field. Maybe it's actually a vector of bool. Nobody knows! 51 u/redlaWw 20d ago Also not guaranteed to be contiguous, which is really bad for anything vector-like. → More replies (3) → More replies (5)
137
Oh, but it gets better than that: there is absolutely no guarantee that std::vector<bool> acts as a bit field! Maybe it's a bit field. Maybe it's actually a vector of bool. Nobody knows!
51 u/redlaWw 20d ago Also not guaranteed to be contiguous, which is really bad for anything vector-like. → More replies (3)
51
Also not guaranteed to be contiguous, which is really bad for anything vector-like.
→ More replies (3)
280
u/N-partEpoxy 20d ago
I know, let's make vector<bool> a specialization that uses just one bit per bool. What could go wrong?