C++ Language Fundamentals
Standards, compilation, namespaces, const-correctness, type deduction, initialisation and value categories. C++ vs C and references have their own pages earlier in this subject.
This is an overview — pick a sub-topic below.
Sub-topics (13)
C++ Overview
A multi-paradigm language created by Bjarne Stroustrup: C's efficiency plus classes, templates and a rich standard library.
C++ Standards (C++98 to C++26)
The ISO versions and their headline features.
Compilation and Linking in C++
Each `.cpp` file becomes an object file; the linker joins them. Templates and inline functions live in headers.
Namespaces
Group names to avoid clashes.
Const Correctness
Mark everything that shouldn't change as `const` — variables, parameters, member functions.
Type Inference: auto and decltype
`auto` deduces a variable's type from its initialiser; `decltype(expr)` gives an expression's type.
Uniform Initialization
Brace initialisation `{}` works for all types and forbids narrowing conversions.
Structured Bindings
Unpack pairs, tuples and structs into named variables (C++17).
Expressions and Statements in C++
Mostly like C, plus range-based `for`, `if`/`switch` with initialisers, and `if constexpr`.
Operators and Overloading Basics
C++ operators can be given meaning for user types (see Operator Overloading).
Casting in C++
Named casts make intent explicit: `static_cast`, `const_cast`, `reinterpret_cast`, `dynamic_cast`.
Lvalues and Rvalues
Lvalues have identity (a named variable); rvalues are temporaries about to disappear.
Value Categories
The full taxonomy: lvalue, prvalue, xvalue (glvalue = lvalue + xvalue; rvalue = prvalue + xvalue).
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.