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

std::to_string — convert a number to text

std::to_string from <string> returns a number's textual representation as a std::string. This entry covers C++23, including floating-point formatting limitations and the distinction from the newer working draft.

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

std::to_underlying — convert an enumeration to its underlying type

std::to_underlying, declared in <utility>, converts an enumeration value to its exact underlying type. Available since C++23, it is constexpr and noexcept; it neither forces the result to int nor checks whether the value corresponds to a named enumerator.

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

std::toupper — convert one character to uppercase

std::toupper from <cctype> returns a character's uppercase equivalent using the current C locale. Its argument must equal EOF or be representable as unsigned char; its return type is int.

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

std::transform — transforming range elements

std::transform from <algorithm> writes the results of a unary or binary operation into an output range. It neither creates a container nor automatically increases its size.

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

std::transform_reduce — transformation and reduction

std::transform_reduce from <numeric> transforms elements of one range or corresponding pairs from two ranges, then combines the results with init. The reduction order and grouping are unspecified.

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

std::tuple — a tuple of elements with fixed types

std::tuple from <tuple> groups a fixed number of elements whose types may differ. std::get provides access, while structured bindings let you give the elements local names.

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

std::u8string — a string of UTF-8 code units

std::u8string is an alias for std::basic_string<char8_t> from <string>. It stores UTF-8 code units but does not validate the encoding; size() does not count user-perceived characters.

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

std::unexpected — explicitly marking an error result

std::unexpected<E> from <expected> wraps an error value to construct std::expected<T, E> in its failure state. It distinguishes an error from a successful result even when T and E are the same type.

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

std::unique — removing consecutive duplicates

std::unique keeps the first element of each consecutive group of equivalent elements. It returns the new logical end of the range without reducing the container's size.

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

std::unique_lock — flexible mutex lock management

std::unique_lock is a movable but noncopyable RAII object from <mutex> that manages mutex lock ownership. It supports deferred locking, unlocking before scope exit, and locking again. Its destructor unlocks the mutex only when the object still owns the lock.

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

std::unique_ptr — exclusive resource ownership

std::unique_ptr is an exclusively owning smart pointer that automatically disposes of its resource. It cannot be copied, but ownership can be moved to another pointer.

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

std::unordered_map — a hash map with unique keys

std::unordered_map stores key–value pairs without a guaranteed order. Learn non-inserting lookup, the difference between operator[] and at, and how bucket management affects iterator validity.

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

std::unordered_multimap — multiple values for one key

std::unordered_multimap stores key–value pairs and permits multiple entries with equivalent keys. It provides hash-based lookup but does not keep keys sorted. Use equal_range to retrieve every matching entry.

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

std::unordered_multiset — a hash container allowing duplicates

std::unordered_multiset stores keys while allowing multiple equivalent occurrences. It supports lookup and removal without maintaining sorted order, and requires the hash function to agree with the key equivalence predicate.

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

std::unordered_set — a set of unique keys

std::unordered_set stores unique keys using hashing. It supports membership checks, insertion, and removal without guaranteeing iteration order. Common operations have constant average complexity but linear worst-case complexity.

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

std::upper_bound — the boundary after equivalent elements

`std::upper_bound` finds the partition boundary for the search value: it returns an iterator to the first element for which `value` compares less than that element, or `last` if no such element exists. With the default comparison on numbers sorted in ascending order, this is the first number greater than `value`.

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

std::uppercase — uppercase letters in numeric output

std::uppercase is a stream manipulator that selects uppercase letters in formatted numeric output, such as hexadecimal digits A–F and the exponent marker E. It does not transform text or select a number base; the setting remains active until changed.

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

std::variant — one of a fixed set of alternative types

std::variant stores a value of one of the alternatives specified by its template parameters and manages that value's lifetime. It models data such as “number or text” and provides checked ways to inspect and handle the active alternative.

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

std::vector — dynamic array

std::vector manages a resizable sequence of elements. Learn the difference between size and capacity, how to add and remove elements, how iterators provide access, and when pointers and references become invalid.

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

std::vformat — formatting with a runtime format string

std::vformat from <format> builds a string from a format string and a std::format_args argument pack. It accepts a pattern determined at runtime and reports invalid formatting for the supplied arguments through std::format_error.

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

std::views::all — a view of an entire range

std::views::all adapts a range to the view interface while retaining every element. Its result can be a copy or move of an existing view, a reference view, or an owning view; that choice determines how data lifetime must be managed.

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

std::views::chunk — divide a range into chunks

C++23 std::views::chunk creates a lazy range of views over successive, non-overlapping groups of n elements. The final chunk may be shorter; n must be positive.

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

std::views::drop — skipping the first N elements

std::views::drop creates a view of a range without its first N elements, without erasing them from the container. Use either the two-argument call or pipeline syntax. The number of elements to skip must be nonnegative.

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