Cheat Sheets & Infographics Cheat Sheets & Infographics Cheat Sheets
Algorithms
Overview
Gallery…
Non-Modifying
[C++ standard library visual overview of existence query algorithms]
[C++ standard library visual overview of algorithms for finding single elements in sequences]
[C++ 20/23 standard library visual overview of algorithms for finding single elements in sequences]
[C++ standard library visual overview of algorithms for finding runs of equivalent elements in sequences]
[C++ standard library visual overview of algorithms for finding subranges in sequences]
[C++ standard library visual overview of algorithms for comparing ranges]
[C++ standard library visual overview of algorithms for finding smallest and largest elements in sequences]
[C++ standard library visual overview of algorithms for binary searches in sorted sequences]
[C++20 standard library visual overview of algorithms for binary searches in sorted sequences]
[C++ standard library visual overview of sequence structure query algorithms]
[C++ standard library visual overview of sequence structure query algorithms]
[C++ standard library visual overview of range traversal algorithms]
Copying
Reordering
[C++ standard library visual overview of algorithms that shift sequences]
[C++20 standard library visual overview algorithms that shift sequences]
[C++ standard library visual overview of sorting algorithms]
[C++ standard library visual overview of sorting algorithms]
[C++ standard library visual overview of sequence partitioning algorithms]
[C++20 standard library visual overview of sequence partitioning algorithms]
[C++ standard library visual overview of sequence permutation algorithms]
[C++ standard library visual overview of algorithms for array-based heap operations]
[C++20 standard library visual overview of algorithms for array-based heap operations]
Modifying
[C++ standard library visual overview of algorithms for modifying range elements]
[C++20 standard library visual overview of algorithms for modifying range elements]
[C++ standard library visual overview of algorithms for replacing range elements]
[C++ standard library visual overview of algorithms for removing range elements]
[C++20 standard library visual overview of algorithms for removing range elements]
[C++ standard library visual overview of operations on sorted sequences]
[C++20 standard library visual overview of operations on sorted sequences]
Numeric
Views
Containers
std:: Sequence Containers
std::vector<ValueType>
std::deque<ValueType>
std::list<ValueType>
std::forward_list<ValueType>
std::forward_list<T>
std::string
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>
std:: Special Containers
Iterators
Iterator Range
end-of-range iterator q
points one behind the last element in the range
Iterator Range Examples
Which Sequence Container Should I Use?
vector Growth
vector Memory
Example: vector object w on the stack
vector<int> w {0,1,2,3,4};
w.reserve(8);
Randomness
Utilities
Language
Non-Standard Libraries
{fmt} v8.0 – Printing & Formatting
{fmt} v8.0 – Time & Date Formatting
std::format and std::strftime use the same formatting tokens
Design
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
Terminology
Related …
- 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)
Last updated: 2023-02-19
Found this useful? Share it: