C++ Cheat Sheets & Infographics (original) (raw)
Iterators
[ ](cpp/std/iterators%5Fintro.html "click to go to page "Iterators (Introduction)"")
Iterator Range
[ ](cpp/std/iterators%5Fintro.html#iterator-ranges "click to go to page "Iterators (Introduction)"")
end-of-range iterator **q**points one behind the last element in the range
Iterator Range Examples
[ ](cpp/std/iterators%5Fintro.html#iterator-ranges "click to go to page "Iterators (Introduction)"")
Which Sequence Container Should I Use?
vector Growth Scheme
[ ](cpp/std/vector.html#how-growing "click to go to page "std::vector"")
vector Memory Layout (typical)
Example: vector object w on the stack
vector<int> w {0,1,2,3,4};
w.reserve(8);[ ](cpp/std/vector.html#memory-layout "click to go to page "std::vector"")
Function Parameters & Return Values Fn Interfaces C++17
- prefer specific types over general-purpose types
- don't use getter/setter pairs for classes
- use descriptive action names (verbs) for mutating member functions
- avoid direct mutable access to class member variables from the outside
- Design Study: Function Interfaces
String(-Like) Function Parameters
[ ](cpp/recipe/string%5Fparameters.html "click to go to page "Strings: Which Function Parameter Type?"")
Don't Throw Exceptions in Destructors!
Parent (of type **A**) gets destroyed and the destructor of one child (type **B**) throws an exception ⇒ resources may leak!
[
](cpp/lang/exceptions.html "click to go to page "Exceptions"")
Binary Representations of Numeric Values
Function Contracts
[ ](cpp/lang/function%5Fbasics.html#design "click to go to page "Functions (Basics)"")
- Vast Collection of Cheat Sheets (by Alexander Krassotkin)
- Rico's Cheat Sheets (for tools & languages)
- Wizard Zines – Nice Cheat Sheets and Posters (by Julia Evens)
- Quickref.me – Cheat Sheet Collection
- C++ Core Guidelines Cheatsheet(s)
- git Branching (Cheat Sheet)
- git Revisions (Cheat Sheet)
- git Tricks (Cheat Sheet)
- tig Commands (Cheat Sheet)
Last updated: 2023-02-19
Found this useful? Share it:

