1114
Tell me the truth ... (piefed.jeena.net)
you are viewing a single comment's thread
view the rest of the comments
[-] pelya@lemmy.world 33 points 3 days ago

std::vector<bool> fits eight booleans into one byte.

[-] borokov@lemmy.world 2 points 1 day 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.

[-] TimeSquirrel@kbin.melroy.org 8 points 3 days ago

std::vector<std::vector> is how I stored the representation of a play field for a Tetris game I made once.

this post was submitted on 15 May 2025
1114 points (100.0% liked)

Programmer Humor

23326 readers
466 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS