@[email protected] to Programmer [email protected] • 4 months agoTell me the truth ...piefed.jeena.netimagemessage-square167fedilinkarrow-up11.16Kcross-posted to: [email protected]
arrow-up11.16KimageTell me the truth ...piefed.jeena.net@[email protected] to Programmer [email protected] • 4 months agomessage-square167fedilinkcross-posted to: [email protected]
minus-squareTimeSquirrellinkfedilink6•4 months agostd::vector<std::vector<bool>> is how I stored the representation of a play field for a Tetris game I made once.
minus-square@[email protected]linkfedilink2•4 months agoauto v = std::vector<bool>(8); bool* vPtr = v.data; vPtr[2] = true; // KABOOM !!! I’ve spent days tracking this bug… That’s how I learned about bool specialisation of std::vector.
std::vector<bool>
fits eight booleans into one byte.std::vector<std::vector<bool>> is how I stored the representation of a play field for a Tetris game I made once.
I’ve spent days tracking this bug… That’s how I learned about bool specialisation of std::vector.