Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Knowledge base

Knowledge base

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

Entries: 5788

C++

std::views::take — a view of a range's first elements

std::views::take, declared in <ranges>, creates a view of at most count leading elements of a range. It preserves their order, does not create a separate container, and supports both direct calls and pipeline notation.

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

std::views::take_while — a prefix satisfying a condition

std::views::take_while creates a lazy view of the initial range elements satisfying a predicate. It ends before the first element that fails the condition and does not resume searching for later matches.

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

std::views::transform — lazy range transformation

std::views::transform creates a view that computes a function's result for an element only when that element is accessed. It does not create a result container; use it directly or in a pipeline with the | operator.

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

std::views::values — a view of second elements

std::views::values creates a lazy view of index-1 elements from pairs or tuples. It lets you traverse map values or modify the second fields of pairs without creating a separate container.

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

std::views::zip — iterate over ranges together

std::views::zip creates a lazy view of elements at corresponding positions in several ranges. Iteration stops at the shortest range, and reference access lets you modify mutable source elements.

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

std::visit — invoke a callable for active alternatives

std::visit, declared in <variant>, invokes a callable with the active value from each supplied std::variant object. With no variants, std::visit(visitor) invokes visitor with no arguments if that invocation is valid. Alternatives are selected at runtime, but the invocation is checked at compile time for every combination of alternatives.

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

std::void_t — detecting valid types

std::void_t from <type_traits> maps any valid pack of type arguments to void. Combined with SFINAE, it can detect whether a nested type is available without making the entire program ill-formed.

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

std::weak_ptr — observation without extending object lifetime

std::weak_ptr<T> observes an object managed by std::shared_ptr without keeping it alive. Its lock() member obtains a temporary shared owner or an empty std::shared_ptr if ownership has already expired.

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

std::wstring — a string of wchar_t elements

std::wstring is an alias for std::basic_string<wchar_t>, defined in <string>. It manages string storage and supports appending, comparison, and element access. It does not guarantee a portable Unicode encoding.

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

ABI and PImpl: hiding implementation without promising full binary compatibility

PImpl moves a class's data into a hidden implementation object. It reduces header dependencies and helps preserve the public class layout, but does not guarantee ABI compatibility by itself. The key mechanics are an incomplete nested type and an out-of-line destructor.

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

Allocators and memory resources

An allocator determines how a container obtains and releases storage. std::pmr resources let you select allocation behavior at runtime without changing the container type, but require careful ordering of object lifetimes.

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

Program architecture: responsibilities and dependencies

Program architecture defines responsibilities, dependency direction, and object ownership. The example combines strategy pattern, factory registry, dependency injection, and decorator, while treating singleton as a separate decision about access and lifetime.

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

Asynchrony and concurrency

Asynchrony separates submitting work from obtaining its result. Concurrency lets tasks make progress over overlapping periods, but does not guarantee parallel execution. In C++, std::async and std::future support this separation with an explicit waiting point.

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

Class-specific allocation and deallocation operators

A class can define its own operator new and operator delete to control storage allocation and release. Overloads taking std::align_val_t handle alignment and must cooperate with the appropriate storage-release function.

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

Collections and containers

A collection is a general term for a group of elements. The C++ standard library provides containers with different storage and access rules: sequences, associative containers, and adaptors.

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

Comments and documentation

C++ provides // comments extending to the end of a line and /* ... */ block comments. They let you explain code and write documentation without executing their contents. Block comments cannot be nested.

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

Compile-time evaluation

Compile-time evaluation determines values under C++ constant-expression rules. Learn how constexpr, consteval, and static_assert differ, and distinguish branch selection with if constexpr from conditional compilation controlled by a feature flag.

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

Conditions and conditional control flow

Conditional control flow chooses which part of a program executes based on a condition. Learn if, else if, else, conversion to bool, short-circuit evaluation of logical operators, and value selection with ?:.

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

Copy elision, NRVO and implicit move

Distinguish guaranteed construction from a prvalue, optional NRVO, and implicit move in C++23. Returning by value does not necessarily copy anything, but program correctness must not depend on NRVO being performed.

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

Coroutines

A coroutine can suspend execution and resume later while preserving the state it needs. The keywords co_await, co_yield, and co_return cooperate with a promise type and a coroutine handle; they do not automatically start a thread or scheduler.

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

Data processing pipelines

A pipeline divides data processing into successive stages. In C++, range adaptors let you compose filtering and transformation with operator |, while the resulting view computes values lazily during iteration.

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

Error handling: bounded retry and fallback

Error handling separates detecting failure from deciding what to do next. Learn transient versus permanent failure, bounded retry, fallback, and idempotence through a deterministic std::expected example.

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

Exception safety: guarantees and copy-and-swap

Exception-safety guarantees specify what remains after an operation fails: valid state, unchanged state, or no escaping exception. Copy-and-swap can provide the strong guarantee by preparing a copy before committing a change.

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

Expressions and operators

Expressions describe computations, while operators specify actions on operands. Learn precedence, associativity, evaluation order, and short-circuit evaluation to read and write C++ expressions correctly.

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