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::ostringstream — building text with a stream

std::ostringstream, declared in <sstream>, formats values into text stored in memory. It uses operator << like an output stream, while str() retrieves the result as a std::string.

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

std::out_of_range — argument outside its expected range

std::out_of_range, declared in <stdexcept>, reports an argument value outside its expected range. It carries a message available through what() and derives from std::logic_error.

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

std::overflow_error — reporting arithmetic overflow

std::overflow_error, declared in <stdexcept>, reports arithmetic overflow. It does not detect overflow automatically: code must check bounds before a risky operation and explicitly throw the exception.

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

std::packaged_task — a callable task with a future result

std::packaged_task wraps a callable and stores its result or exception in shared state. std::packaged_task::get_future provides a std::future for retrieving that result; the task itself does not start a new thread.

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

std::pair — a pair of two values

std::pair<T1, T2> groups two values, potentially of different types, in one object. Its public first and second data members provide direct access to the first and second elements.

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

std::partial_ordering — a partial comparison result

std::partial_ordering from <compare> represents a comparison result that can be less, equivalent, greater, or unordered. The unordered state means the values are incomparable, not equivalent.

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

std::partial_sort — a sorted prefix of a range

std::partial_sort selects the smallest k elements and places them in a sorted prefix of the range. It modifies the input, while the order of the remaining elements is unspecified.

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

std::partial_sum — prefix sums

std::partial_sum from <numeric> writes successive prefix sums of a range. It also accepts a custom binary operation; its accumulator uses the input value type, independently of the output type.

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

std::partition — partition a range by a predicate

std::partition rearranges a range so that elements satisfying a predicate precede the others. It returns the boundary iterator between the groups, but does not guarantee that order within either group is preserved.

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

std::plus — addition function object

std::plus from <functional> exposes operator + as a callable object. std::plus<T> fixes the type T, whereas std::plus<> deduces the argument types and the expression's result type.

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

std::pmr::memory_resource — polymorphic memory resource

std::pmr::memory_resource is an abstract interface for allocating and deallocating storage with a specified alignment. It enables runtime selection of an allocation strategy, while std::pmr::polymorphic_allocator connects that interface to code expecting an allocator.

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

std::pmr::monotonic_buffer_resource — allocation with bulk release

std::pmr::monotonic_buffer_resource supplies storage for successive allocations while ignoring individual deallocations. release() returns upstream blocks and resets the resource for reuse.

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

std::pmr::polymorphic_allocator — runtime memory-resource selection

std::pmr::polymorphic_allocator<T>, declared in <memory_resource>, routes memory requests to a std::pmr::memory_resource object. It lets allocation strategies vary at runtime without changing the allocator type or the container type that uses it.

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

std::pmr::string — a string with a polymorphic allocator

std::pmr::string is a std::basic_string specialization using std::pmr::polymorphic_allocator<char>. It lets you select a memory resource at runtime without changing the string's type.

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

std::pmr::synchronized_pool_resource — synchronized memory pooling

std::pmr::synchronized_pool_resource manages pools of memory blocks and supports concurrent access from multiple threads. It can supply storage to PMR containers, but resource synchronization does not make concurrent modifications of a container safe.

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

std::pmr::unsynchronized_pool_resource — memory pools without synchronization

std::pmr::unsynchronized_pool_resource manages pools of memory blocks for polymorphic allocators. It allows deallocated blocks to be reused, but requires careful resource lifetimes and prevention of simultaneous access from multiple threads.

Intermediate · C++23; repository compiler flag, production runtime not attested
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