Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C++

Knowledge base — C++

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 674

C++

Program entry point: main

In a hosted environment, the global-scope main function is the entry point of a C++ program. It returns int, can receive startup arguments, and supplies the termination status.

Basic · C++23; repository compiler flag, production runtime not attested
C++

RAII and resource ownership

RAII ties resource management to an object's lifetime: initialization establishes ownership, and the destructor releases the resource. A correctly designed owner therefore also performs cleanup during exception-driven stack unwinding.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Ranges and views

A range exposes elements through a beginning iterator and an end sentinel. A view is a range with additional requirements that make it useful for building pipelines. The std::views::filter and std::views::transform adaptors select and transform elements without creating an intermediate result container.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Records and aggregates

A record groups named fields, usually in a struct. An aggregate is a formal C++ category that allows element initialization without a user-declared constructor. Not every struct is an aggregate.

Basic · C++23; repository compiler flag, production runtime not attested
C++

Recursion

Recursion means a function calls itself, directly or through other functions. For the computation to terminate, it needs a reachable base case and recursive steps that make progress toward that case.

Basic · C++23; repository compiler flag, production runtime not attested
C++

Reductions and statistics

A reduction combines a range into one result. Learn how std::accumulate, std::reduce, and std::transform_reduce differ, and calculate a mean and variance while accounting for accumulator types and operation order.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Name scope versus object lifetime

Scope determines the context for name lookup in source code, while lifetime describes an object's existence during execution. Hiding a name does not destroy its object. Storage duration is a separate, related concept.

Basic · C++23; repository compiler flag, production runtime not attested
C++

Security boundaries in C++

A security boundary separates data or code with different levels of trust. In C++, private access control must not be confused with execution isolation: validating data before use is a separate responsibility, and undefined behavior does not guarantee safe program termination.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

SFINAE — substitution failure versus a compilation error

SFINAE allows a template overload to be discarded when argument substitution produces an invalid type or expression in the immediate context. It does not hide arbitrary template errors.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Sorting, comparisons, and search ranges

Correct sorting requires a comparator that defines a strict weak ordering. Binary search requires a range partitioned for the relevant condition; sorting the entire range is sufficient but not always necessary.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Strings and text: code units, code points, and grapheme clusters

A C++ string stores elements, not ready-made user-visible characters. Learn the distinction between UTF-8 code units, Unicode code points, and grapheme clusters, and understand the roles of std::u8string and a u8 string literal.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Templates and concepts: constrained template parameter

Templates describe families of functions or types, while concepts state requirements on template arguments. The declaration template<Integer T> introduces a type parameter T constrained by Integer<T>, checked during compilation rather than at runtime.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Testing and assertions

Tests compare program behavior with expectations, while assertions express conditions that should hold. Learn property-based testing, idempotence, and a deterministic test corpus, plus the distinction between assert, static_assert, and checks that remain active when NDEBUG is defined.

Basic · C++23; repository compiler flag, production runtime not attested
C++

Dates and time with std::chrono

std::chrono separates durations, time points, and calendar dates. Learn the %F and %R formats and the distinction between a fixed UTC offset and a named time zone.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Translation units, linkage, and the ODR

Translation units let parts of a program be translated separately. Linkage determines name identity across declarations, while the ODR constrains the number and form of definitions. Distinguishing these concepts helps you split code correctly between headers and implementation files.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Type conversion

Type conversion adapts an expression to a required type. Learn implicit conversions, explicit static_cast conversions, integral promotions, and discarding a value with a cast to void.

Basic · C++23; repository compiler flag, production runtime not attested
C++

Type system

The C++ type system defines the types of objects, references, functions, and expressions, together with permitted operations and conversions. Typing is static: auto deduces a type but does not let a variable change type later. Implicit conversions may be allowed even when they risk losing information.

Basic · C++23; repository compiler flag, production runtime not attested
C++

User-defined literals

A user-defined literal combines a numeric, character, or string literal with a custom suffix. Its literal operator turns that spelling into a value, such as an object representing a distance.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Value categories and move semantics

The categories lvalue, prvalue, and xvalue describe expressions, not kinds of variables. Learn their glvalue and rvalue groupings and how they relate to references, overload selection, and std::move, which does not itself transfer resources.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

Variables in C++

A variable lets a program store and refer to data of a particular type. Learn declarations, initialization, assignment, the roles of auto and const, and the distinction between a name's scope and an object's lifetime.

Basic · C++23; repository compiler flag, production runtime not attested
C++

Algorithm execution-policy constants

The objects std::execution::seq, std::execution::par, std::execution::par_unseq and std::execution::unseq specify how an algorithm is permitted to execute. They do not guarantee a speedup; choosing a policy also changes the requirements on functions that process elements.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

INT_MAX — the largest int value

The INT_MAX macro from <climits> specifies the largest int value for an implementation. Use it instead of hard-coding the limit, and check it before incrementing a value to avoid overflow.

Basic · C++23; repository compiler flag, production runtime not attested
C++

Atomic memory orders

Constants of type std::memory_order control synchronization and ordering for atomic operations. Learn how relaxed, release, acquire, acq_rel, and seq_cst differ, and how an atomic flag can safely publish ordinary data.

Intermediate · C++23; repository compiler flag, production runtime not attested
C++

std::ignore — skipping elements during tuple assignment

std::ignore is a standard-library object used with std::tie to skip selected elements during tuple assignment. It lets you store the values you need in existing variables without creating a dummy variable for the skipped element.

Basic · C++23; repository compiler flag, production runtime not attested