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::pop_heap — move the heap root to the end

std::pop_heap moves the root of a nonempty heap to the end of the range and restores the heap in the remaining prefix. It does not erase a container element. For std::vector, pop_back() removes the extracted element only if the heap range ends at the end of the vector.

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

std::prev — an iterator moved backward

std::prev from <iterator> returns a shifted copy of a bidirectional iterator without changing the argument. It moves backward by one step by default; negative n means moving forward. The caller must ensure that the movement stays within valid bounds and that evaluating -n does not overflow.

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

std::prev_permutation — previous lexicographical permutation

std::prev_permutation rearranges a range into its previous lexicographical permutation. It returns bool; when no previous permutation exists, it rearranges the range into the last permutation and returns false.

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

std::print — formatted output

std::print from <print> writes formatted data to stdout or a specified FILE* stream. It uses replacement fields such as {} and does not automatically append a newline.

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

std::println — formatted output with a newline

std::println from <print> formats arguments, writes the result, and appends a newline. It uses stdout by default; an overload accepting FILE* lets you select another output stream.

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

std::priority_queue — priority queue

std::priority_queue exposes the highest-priority element rather than the earliest inserted one. By default, the largest value is on top; std::greater<T> reverses the ordering.

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

std::promise — delivering a value or exception

std::promise<T> stores a single result in shared state read through std::future<T>. The result can be a value or an exception; the promise object itself does not start a computation or thread.

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

std::push_heap — adding an element to a heap

std::push_heap restores the heap property after one element has been appended to a range. It does not grow the container: the new element must already be at last - 1, and the preceding part of the range must already be a valid heap.

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

std::queue — FIFO queue

std::queue is a container adaptor implementing FIFO order: the first element inserted is the first removed. It supports insertion at the back, access to both ends, and removal from the front, without a public iterator interface.

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

std::ranges::copy — copying range elements

std::ranges::copy copies elements in input order to a destination specified by an output iterator. It accepts either a whole range or an iterator and sentinel, and returns the final input and output positions.

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

std::ranges::equal_range — a range of equivalent elements

std::ranges::equal_range finds the half-open range of elements equivalent to a search value under a comparator. It supports ranges, iterator–sentinel pairs, and projections; it requires appropriately partitioned data, which sorting guarantees.

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

std::ranges::find — first match in a range

`std::ranges::find` locates the first element equal to a supplied value, optionally after projection. The result is not a `bool`: an iterator points to the first match or marks the end if there is no match. The range overload instead returns `std::ranges::dangling` when passed an rvalue range that does not satisfy `borrowed_range`.

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

std::ranges::greater — comparing in descending order

std::ranges::greater is a function object from <functional> that compares two arguments in the reverse order of std::ranges::less. It requires compatible comparison operations described by std::totally_ordered_with.

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

std::ranges::input_range — a readable range

std::ranges::input_range describes a range whose iterator supports reading elements and advancing to subsequent positions. It does not guarantee multiple passes: reading may consume data, as with a stream view.

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

std::ranges::is_sorted — checking whether a range is sorted

std::ranges::is_sorted returns a bool indicating whether a range is ordered according to a comparator and projection. It does not sort the data; by default, it checks nondecreasing order and allows duplicates.

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

std::ranges::less — less-than comparison

std::ranges::less is a function object type from <functional> that compares two arguments. It supports compatible different types, requires std::totally_ordered_with, and returns bool.

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

std::ranges::sort — sorting a range with a projection

std::ranges::sort from <algorithm> sorts elements within an existing range. It accepts a whole range or an iterator and sentinel, plus an optional comparator and key projection.

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

std::ranges::subrange — an iterator–sentinel view

std::ranges::subrange from <ranges> combines a starting iterator and an ending sentinel into a view of [first, last). It does not copy elements into a new container; it lets you pass a selected portion of data as one object.

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

std::ranges::to — constructing a container from a range

C++23 std::ranges::to constructs an object, usually a container, from an input range. It lets you finish a view pipeline with a concrete result, specifying either the full container type or a template whose arguments will be deduced.

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

std::ranges::transform — transform elements into an output

std::ranges::transform computes values from one range or corresponding elements of two ranges and writes them through an output iterator. It is an eager algorithm, not a lazy view.

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

std::ranges::view_interface — an interface for custom views

std::ranges::view_interface is a CRTP base for custom views. It supplies convenience members from range operations, but their availability depends on the capabilities of the iterator and sentinel.

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

std::recursive_mutex — repeated locking by the same thread

std::recursive_mutex lets the same thread acquire the same mutex repeatedly. Other threads can acquire it only after every ownership level has been released. Each successful acquisition requires a separate unlock.

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

std::reduce — reduction with unspecified ordering

std::reduce from <numeric> combines a range and an initial value into one result. It may reorder and regroup operations, so it is not a substitute for std::accumulate when evaluation order matters.

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

std::reference_wrapper — a copyable reference wrapper

std::reference_wrapper stores a reference without owning its target. Learn std::ref, std::cref, and the difference between modifying the referenced object and changing which object the wrapper references.

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