@[email protected] to Programmer [email protected] • 3 days agoTell me the truth ...piefed.jeena.netimagemessage-square144fedilinkarrow-up11.13Kcross-posted to: [email protected]
arrow-up11.13KimageTell me the truth ...piefed.jeena.net@[email protected] to Programmer [email protected] • 3 days agomessage-square144fedilinkcross-posted to: [email protected]
minus-square@[email protected]linkfedilink23•2 days agoWell there are containers that store booleans in single bits (e.g. std::vector<bool> - which was famously a big mistake). But in the general case you don’t want that because it would be slower.
minus-square@[email protected]linkfedilinkEnglish7•1 day agoWhy is this a big mistake? I’m not a c++ person
minus-square@[email protected]linkfedilink4•1 day agoThe mistake was that they created a type that behaves like an array in every case except for bool, for which they created a special magical version that behaves just subtly different enough that it can break things in confusing ways.
Well there are containers that store booleans in single bits (e.g.
std::vector<bool>
- which was famously a big mistake).But in the general case you don’t want that because it would be slower.
Why is this a big mistake? I’m not a c++ person
The mistake was that they created a type that behaves like an array in every case except for
bool
, for which they created a special magical version that behaves just subtly different enough that it can break things in confusing ways.Could you provide an example?