What Is This Guide?
About
- an organized collection of links to topic articles
- about learning modern, idiomatic C++
- (roughly) ordered by increasing level of C++ proficiency
(top to bottom)
- many articles are based on slide decks taken
from an undergraduate C++ crash course
What Should I Already Know?
Required Knowledge
You should know how to use a
command line
and should have a basic understanding of fundamental
imperative programming concepts, like
- variables
(
int i = 0, var x = 0, …
)
- conditional branching
(
if, then, else, …
)
- loops
(
for, while, repeat, …
)
- functions / subroutines
(
int main(), fn main, …
)
It certainly helps if you are already somewhat familiar with other
programming languages like Python or Java.
You should be aware however, that C++ is very different
from Java or C# despite the superficial syntactic similarities.
What is C++? — Why C++?
What is C++?
C++?
Predictable Resource Control
"direct map to hardware": CPU, memory, …
Zero-Overhead Abstractions
"you only pay for what you use"
- deterministic object lifetime
-
value semantics
for all types
- custom types can behave exactly like built-in types
- full control down to individual bits
ISO Standard C++
C++98 |
1998 |
the original standard |
|
C++11 |
2011 |
almost a new language |
modern C++ |
C++14 |
2014 |
some improvements |
C++17 |
2017 |
new features & library extensions |
C++20 |
2020 |
game-changing new features & libraries |
Where it does and doesn't shine
- if memory consumption is critical
- if runtime is critical
- if latency is critical
- if power consumption is critical
- OS level programming
- embedded systems
- large-scale, massively parallel systems
- source-code portability across architectures
- "scripting" & rapid prototyping
- GUIs with trivial internal logic
C
|
not a strict subset of C++ |
stronger type system |
weak type system |
high-level abstractions |
only low-level memory abstraction |
powerful custom types (class es) |
only data aggregation (struct ) |
use compiler as correctness checker |
get the code to compile quickly |
if it compiles, it should be correct |
debugging is the real work |
Java
value semantics
for all types |
value semantics
only for primitives
(int , float ,… ) |
optional
reference semantics for all types |
baked-in
reference semantics for class types |
full control over memory (de-)allocation;
no garbage collection |
garbage collector; can degrade performance |
deterministic & controllable object lifetime |
no predictable object lifetime control |
⇒ memory frugal |
⇒ high memory consumption |
aggressive inlining can eliminate
slow function calls |
performance degradation due to
un-devirtualizable, non-inlinable methods |
Python
almost always faster |
almost always slower (in practice around 25-50 times) |
complex syntax and tons of features can
be intimidating to newcomers |
simple syntax; usually easy to comprehend |
statically typed |
dynamically typed |
many types of bugs can be caught at compile time |
many types of bugs will only manifest at runtime |
suited for safety-critical lange-scale systems |
hard to build reliable large-scale systems |
even simple, small-scope tasks can quickly require an
expert knowledge of various arcane corner cases & quirks |
tends to be more beginner-friendly and
small scripts are usually quickly written |
fairly small standard library but extensive ecosystem with
libraries for nearly everything |
batteries included philosophy with tons of libraries
only one import away |
Learning Resources
Resources
Custom Types – Part 1
Custom Types 1
Terms
warnings |
are compiler messages hinting at potentially problematic
runtime behavior / subtle pitfalls |
static analysis |
finds potential runtime problems
like undefined behavior
by analyzing the source code |
dynamic analysis |
finds potential problems like memory leaks
by running the actual program |
profiling |
is used to find out how much each function/loop/code block
contributes to the total running time, memory consumption, … |
debugging |
is used to step through code at runtime and inspect in-memory values |
testing |
compare actual and expected behavior of parts or entire program |
code coverage |
tells what parts of the code are actually executed / subjected to testing |
Standard Library Overview
Standard Library
Std.Library
Standard Algorithms
Algorithms
- Introduction & Basic Paradigms
- Container Traversal
- Minimum & Maximum (
min_element
, …)
- Existence Queries (
any_of
, count
, …)
- Finding Elements (
find
, find_if
, …)
- Sequence Reordering (
reverse
, rotate
, …)
- Changing Elements (
replace
, transform
, …)
- Function Objects
- Lambdas (Basics)
- Numeric Algorithms (
accumulate
, iota
, …)
- Sorted Sequence Operations (
binary_search
, …)
Separate Compilation In One Image (click to enlarge)

Custom Types – Part 2
Custom Types 2