C++ Cheat Sheets & Infographics (original) (raw)

standard library sequence containers overview

std::vector interface visual overview

std::deque interface visual overview

std::list interface visual overview

std::forward_list interface visual overview

std::string interface overview cheat sheet

standard library associative containers overview

std::set / std::multiset interface visual overview

std::map / std::multimap interface visual overview

std::unordered_set / std::unordered_multiset interface visual overview

std::unordered_map / std::unordered_multimap interface visual overview

standard library special containers overview

Iterators

[ example: iterators in C++ ](cpp/std/iterators%5Fintro.html "click to go to page "Iterators (Introduction)"")

Iterator Range

[ iterator range convention: pair of iterators ](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

[ examples of various iterator ranges ](cpp/std/iterators%5Fintro.html#iterator-ranges "click to go to page "Iterators (Introduction)"")

Which Sequence Container Should I Use?

flowchart for selecting an appropriate standard library container

vector Growth Scheme

[ example of growing a std::vector works internally ](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);

[ simplified std::vector memory layout ](cpp/std/vector.html#memory-layout "click to go to page "std::vector"")

an overview of standard library random distribution types

an overview of standard library random distribution types

std::numeric_limits values and binary number representations for signed integers, unsigned integers and floating point numbers

example-based overview of formatting and printing with the {fmt} library

Function Parameters & Return Values Fn Interfaces C++17

cheat sheet about what function parameter types and return types to use

String(-Like) Function Parameters

[ cheat sheet about what type to use for string-like functions 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!

[ example showing why throwing destructors are bad ](cpp/lang/exceptions.html "click to go to page "Exceptions"")

Binary Representations of Numeric Values

binary representations of numeric values: unsigned integers, signed integers and IEEE 754 floating point numbers

Function Contracts

[ overview of function contract terminology: preconditions, postconditions, invariants, side effects ](cpp/lang/function%5Fbasics.html#design "click to go to page "Functions (Basics)"")



Last updated: 2023-02-19

Found this useful? Share it: