[HN Gopher] C++ Cheat Sheets ___________________________________________________________________ C++ Cheat Sheets Author : ibobev Score : 85 points Date : 2022-03-06 18:41 UTC (4 hours ago) (HTM) web link (hackingcpp.com) (TXT) w3m dump (hackingcpp.com) | BeetleB wrote: | This should be titled "C++ Algorithms Library Cheat Sheet". It is | specifically about the algorithms functions in the standard | library. | bialpio wrote: | There's a bunch of categories, the first one is indeed standard | algorithms. Full list: Standard Algorithms, Standard | Randomness, Standard Sequence Views, Standard Containers, | Standard Utilities, Language Mechanisms, Libraries, Design | Guidelines, Engineering, Terminology. Seems fairly | comprehensive to me. | jll29 wrote: | I'm usually not a fan of "cheat sheets" (HTML online | documentation, man pages and even real books are quickly at hand) | - but this is a useful (and pretty) synopsis of many useful | library functions and recent additions to C++, thanks. | woodruffw wrote: | In a similar vein: I've had the "initialization in C++17" chart | taped above my desk for a 3 years now[1]. | | [1]: https://timur.audio/initialisation-in-c17-the-matrix | echelon wrote: | This is fantastic, thanks! | itsmenow wrote: | wow, this is really fantastic! The whole site seems quite useful | in fact. | jokoon wrote: | Wow, this is really good, there are still things I can learn. | | C++ really has a lot of good things. It's just a shame it's so | slow to compile. | | I'm curious if anybody is working to make C++ faster to compile. | Even if it was a subset of the language, with some features | removed, it would be good enough for me. | jcelerier wrote: | * Compile with clang, link with mold or at least lld. mold can | link gigabyte-sized binaries in, like, one second | | * Use ninja instead of make | | * Use PCH | | * -gsplit-dwarf | techas wrote: | Off topic. Could you recommend an ide to work with c++? | jcelerier wrote: | I use Qt Creator on every platform | ibobev wrote: | Microsoft Visual Studio for Windows and QtCreator for | Linux. | jll29 wrote: | CLion from JetBrains and Microsoft Visual Code are the best | commercial ones for Linux, NetBeans is a free (as in | freedeom and open source) one (that also supports many | other languages like Java and Python). | | What I don't recommend is Eclipse - it's complex and | confusing for beginners (but a bit faster than some | others). | MetricExpansion wrote: | I didn't think NetBeans supported C++ anymore? | dwrodri wrote: | I can testify to JetBrains products, they're quite good. I | haven't used CLion in a few years because I don't like | depending on a dev tooling that costs money. I use VSCode | because I hop between Python, Bash, Go, C, and C++. That | being said, CLion definitely offers a much better debugging | experience, even when VSCode has all the right plugins. | whimsicalism wrote: | CLion, VSCode, Vim - in order of decreasing tooling. | woodruffw wrote: | This is all solid advice (particularly using a faster | linker). | | IME, the single best way to reduce your C++ compile times is | to _compile less code_ : | | * Remove all unnecessary headers. Template expansion is slow, | and preprocessing is even slower. Some of the standard | includes (like `<regex>` and `<iostream>`) are notorious for | slowing individual translation units to a crawl. `#pragma | once` for your own headers also helps with cpp-time | performance. | | * Forward-declare as much as you can. Forward type | declarations mean that the compiler doesn't need to process | all of `Foo` when it sees `Foo&` or `Foo _`. | | _ Use pImpl wherever you can (and makes sense). Private | implementations similarly reduce the amount of code the | compiler needs to analyze. | | For better or worse, the current winds suggest that C++ | compilation times will only continue to get worse (more | constexpr/consteval, even more complex templating | features/concepts, etc.). ___________________________________________________________________ (page generated 2022-03-06 23:00 UTC)