Live data from Hacker News

C++ Cheat Sheets

hackingcpp.com

81–82 of 82 posts

Re: C++ Cheat Sheets

#81

The sizeof(variant) example is wrong. An extra byte is needed to store the discriminator value, which in practice results in 8 extra bytes for these particular types because of alignment. https://godbolt.org/z/vno3v9rPK The tuple drawing is also somewhat misleading, because the first box (int) should be the same size as the second one (double), due to alignment.

You are right. That was probably dumbed down too much. I'll fix it.

Re: C++ Cheat Sheets

#82

This is a great site! Thanks for putting in all the hard work and sharing with the community.

You're most welcome. I'm glad if people like it and find it useful. If you want to be notified of updates you can follow @hackingcpp on Twitter.
Post reply on HN