cm0002@lemmy.world to Programmer Humor@programming.dev · 4 months agoTell me the truth ...piefed.jeena.netimagemessage-square30linkfedilinkarrow-up1573
arrow-up1573imageTell me the truth ...piefed.jeena.netcm0002@lemmy.world to Programmer Humor@programming.dev · 4 months agomessage-square30linkfedilink
minus-squarepelya@lemmy.worldlinkfedilinkarrow-up13·4 months agostd::vector<bool> fits eight booleans into one byte.
minus-squareborokov@lemmy.worldlinkfedilinkarrow-up2·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.auto 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.