What is an expression in C++?
A C++ expression has a type, a value and a value category. See the kinds of expressions, precedence, C++17 evaluation order and constexpr, with examples.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
A C++ expression has a type, a value and a value category. See the kinds of expressions, precedence, C++17 evaluation order and constexpr, with examples.
C++ has no formal declarative type; it has type declarations. See classes, enum class, using aliases, auto and decltype in modern C++.
Lambda expressions and move semantics are the C++11 features that reshaped everyday C++. See how they work and which other C++11 features still matter.
In C++, noexcept declares that a function will not throw, and noexcept(expr) checks at compile time whether an expression can throw.
A compile-time constant in C++ is a value known during compilation. Learn how const, constexpr, consteval and constinit differ.
A user-defined literal in C++ attaches a custom suffix to a value through a literal operator. See forms, units and std::chrono examples.
Constructor delegation lets one C++ constructor call another constructor of the same class, so shared setup lives in one place. Learn the syntax, rules and pitfalls.
A vtable is the per-class table that C++ compilers use to dispatch virtual functions at run time. See how it relates to the vptr and what it means for your code.
A vptr is a hidden per-object pointer to a class's vtable. See how virtual calls use it, when constructors set it, and what it costs.
The vptr is the hidden pointer in each polymorphic C++ object that points to its class's vtable. See how it affects size, construction and bugs.
A vtable is a per-class table of function pointers that lets C++ call the right override at runtime. Learn its layout, cost and pitfalls.
A friend function is a non-member function with access to a class's private and protected members, declared with the friend keyword inside the class.
A friend class in C++ can access another class's private and protected members. This guide covers syntax, friendship rules, examples and alternatives.
Learn how full and partial template specialization work in C++, why function templates differ, and when if constexpr or concepts are the better choice.
The C++ null statement is a single semicolon. Learn valid uses, why a stray semicolon after if or for is a bug, and how empty loops behave.
The range-based for loop iterates arrays and containers without indexes or iterators. Learn when to use auto, const auto& and auto&, plus structured bindings and pitfalls.
The C++ conditional operator ?: picks one of two values from a condition. See syntax, result types, nesting and precedence pitfalls.
The scope resolution operator :: names the exact scope of an identifier. See namespaces, class members, globals and base class calls.
nullptr is the type-safe null pointer literal of C++11. See how it differs from NULL, fixes overloads and templates, and how to migrate old code.
decltype yields the exact type of an expression at compile time. See its rules, how it differs from auto, and how to use it in templates.