GeezerVison is showing hackingcpp.com — C++ Cheat Sheets & Infographics
Standard Algorithms
Quick Overview
Algorithms Gallery…
Non-Modifying Operations
Copying / Sampling / Moving
Reordering Elements
Modifying Elements
Numeric Operations
Standard Views
Composable Range Views
Ranges
C++20/23
Standard Containers
std:: Sequence Containers
std::vector<ValueType>
std::deque<ValueType>
std::list<ValueType>
std::forward_list<ValueType>
std::forward_list<T>
std::string Interface & Utilities Overview
std:: Associative Containers
std::set<KeyType,Compare>
std::map<KeyType,MappedType,KeyCompare>
std::unordered_set<KeyType,Hash,KeyEqual>
std::unordered_map<KeyType,MappedType,Hash,KeyEqual>
Iterator Range
end-of-range iterator q
points one behind the last element in the range
Which Sequence Container Should I Use?
vector Memory Layout (typical)
Example: vector object w on the stack
vector<int> w {0,1,2,3,4};
w.reserve(8);
Standard Randomness
Standard Random Distributions
C++11
Standard Random Sampling Distributions
C++11
Standard Utilities
Language Rules & Mechanisms
Build Model / Compiling A Project
The "Usual Arithmetic Conversions"
Lambda Expressions
Reference Collapsing C++11
for template arguments
Perfect Forwarding
C++11
of template arguments
Forwarding
Non-Standard Libraries
{fmt} v8.0 – Printing & Formatting
{fmt} v8.0 – Time & Date Formatting
Design Guidelines
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
String(-Like) Function Parameters
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!
Engineering
Binary Representations of Numeric Values
Terminology
Found this useful? Share it: