▲ 1168 ▼ Tell me the truth ... (europe.pub) submitted 1 year ago by cm0002@lemmy.world to c/programmer_humor@programming.dev 170 comments fedilink hide all child comments
[–] pelya@lemmy.world 33 points 1 year ago (2 children) std::vector<bool> fits eight booleans into one byte. permalink fedilink source hideshow 2 child comments replies: [–] TimeSquirrel@kbin.melroy.org 8 points 1 year ago std::vector<std::vector> is how I stored the representation of a play field for a Tetris game I made once. permalink fedilink source parent [–] borokov@lemmy.world 2 points 1 year ago 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. permalink fedilink source parent
[–] TimeSquirrel@kbin.melroy.org 8 points 1 year ago std::vector<std::vector> is how I stored the representation of a play field for a Tetris game I made once. permalink fedilink source parent
[–] borokov@lemmy.world 2 points 1 year ago 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. permalink fedilink source parent