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++

Rvalue reference: T&&

T&& declares an rvalue reference, a type distinct from T&. It binds to suitable rvalues and participates in move semantics. A reference name used as an expression is normally an lvalue. In C++23, however, a move-eligible name is an xvalue, as when the name of an rvalue-reference parameter referring to a non-volatile object type is used directly as the operand of a return statement. T&& with a deduced template parameter can be a forwarding reference.

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

alignas — specifying alignment

alignas specifies an alignment requirement for a variable, data member, or class. It accepts a type or an integral constant expression and cannot weaken the natural alignment of the declared object or type.

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

and — alternative spelling of logical AND

`and` is an alternative spelling of `&&` in C++. The built-in operator tests whether both conditions are true and skips the right operand when the left operand is false.

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

and_eq — alternative spelling of bitwise AND assignment

and_eq is a reserved C++ keyword and an alternative spelling of &=. For built-in integral types, it performs bitwise AND and stores the result in the left operand. It is not the logical operator and.

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

asm — assembly declaration

The asm keyword introduces a declaration typically used to pass text to an assembler. Support is conditional and its meaning is implementation-defined, so it is not a portable way to execute processor instructions.

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

auto — variable type deduction

The auto keyword stands for a type deduced by the compiler from an initializer. It shortens declarations without losing static typing; writing auto& or const auto& specifies whether the declaration creates a reference.

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

bitand — alternative spelling of &

`bitand` is a reserved alternative spelling of the `&` token in C++. It therefore means more than bitwise AND: depending on context, it can also take an address or declare an lvalue reference.

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

bitor — alternative spelling of bitwise OR

`bitor` is an alternative spelling of the C++ operator `|`. The built-in operator performs bitwise inclusive OR: a result bit is set when the corresponding bit of at least one operand is set. Do not confuse it with logical `or` (`||`).

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

break — terminate a loop or switch

The break; statement terminates the nearest enclosing loop or switch statement. Execution continues after the terminated statement, rather than proceeding to the next loop iteration.

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

case — a value label in switch

The case keyword marks an entry point in a switch statement for a particular constant value. A label does not end a branch: without break or another transfer of control, execution continues onward, including through subsequent labels.

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

catch — handling exceptions

The catch keyword introduces an exception handler associated with try. Its parameter type determines matching, while catch (...) matches any exception and must appear last.

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

class — declaring and defining a class

The class keyword declares or defines a class type that can combine data and member functions. Member access and inheritance access default to private, unlike struct, where both default to public.

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

compl — alternative spelling of ~

compl is a built-in C++ alternative spelling of ~. For integer operands, it flips bits after integral promotions. It is not logical negation and requires neither a header nor a macro definition.

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

concept — a named constraint on template arguments

The concept keyword defines a named constraint on template arguments. It lets you reuse requirements checked during compilation and restrict overload availability without adding runtime checks.

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

const — read-only access qualifier

const restricts modification through a particular name, reference, or pointer. Learn the difference between a pointer to const and a const pointer, and what const after a member function's parameter list means.

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

consteval — immediate functions

consteval declares an immediate function: its calls require constant evaluation, with exceptions that let such computations be composed. Unlike constexpr, it does not provide an ordinary runtime execution path for the function. if consteval distinguishes constant-evaluation contexts from runtime evaluation.

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

constexpr — constants and functions for constant evaluation

constexpr requires a constant initializer for a variable and allows a function to participate in constant expressions. It does not force every function call to be evaluated during compilation.

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

constinit — enforcing static initialization

constinit requires static initialization of a variable with static or thread storage duration. It does not make the variable immutable: it constrains initialization, not subsequent assignments.

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

continue — skip the rest of an iteration

The continue; statement skips the remainder of the current iteration of the innermost enclosing loop. It does not terminate the whole loop: subsequent control flow depends on the loop kind, including execution of the step expression in a traditional for loop.

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

co_return — completing a coroutine

co_return finishes execution of a coroutine body and delivers its result to the promise object rather than returning it directly like ordinary return. The coroutine then proceeds to final_suspend(); its state's lifetime depends on the coroutine's ownership mechanism.

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

co_yield — yielding a value from a coroutine

A co_yield expression passes its operand to the coroutine promise object's yield_value and awaits the result. In a generator, this exposes successive values without ending the function; whether execution actually suspends depends on the awaiting mechanism.

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

decltype — an expression's type without evaluation

decltype specifies a type from an expression without executing it. It distinguishes an object's name from a general expression: decltype(x) can denote int, while decltype((x)) denotes int&.

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

default — switch label and = default function definition

The default keyword has two distinct uses: it selects a path in switch when no case matches, or, in an = default definition, asks the compiler to generate a function according to language rules. It does not mean that data members are automatically zeroed.

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

do — a loop with its test at the end

The do keyword starts a do-while loop: its body executes before the controlling expression is tested. The loop repeats while that expression evaluates to true. The trailing semicolon is required.

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