Oh I read it incorrectly. I thought you asked what the bitset behavior was breaking.
Theoretically, it would break all code that try to handle it as a bitset by doing unsafe shitty read/write on the memory address. But also, it would be extremely easy to do a "replace all" of vector<bool> to bitset when upgrading the code.
But my question highlights a problem with vector<bool> - it can't work in generic code that expects vector to be contiguous, addressable with T*, and have a .data() function that gives you that. Because it doesn't.
It doesn't even support &bool_vec[0] or &*begin() - because neither return actual references, but a reference proxy class. You can't take the address of an rvalue class, so it fails to compile entirely.
It's very well defended, but on the flip side it's incompatible with a lot of generic contexts because it doesn't have the same API as vector<T> generally, only a subset of it. Some of which seems to exist solely for there to be a common subset (like the nested reference type alias).
And the worst part is it explicitly has a member function on its nested "reference" type - so currently it can't be left unspecialised by an implementation.
View all comments
Show parent comment
2
u/Scolmann 15d ago
Is there any behavior that breaks from them changing it to be bytes though?
It would take more memory but logically the code should be the same unless someone's doing bitcast BS with it