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::logic_error — program logic exception

std::logic_error, declared in <stdexcept>, represents errors in a program's internal logic, such as violated preconditions or class invariants. It stores a message available through what() and derives from std::exception.

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

std::lower_bound — first position not less than a key

std::lower_bound searches a suitably partitioned range for its boundary: the first element not less than the key, or the end of the range. It returns an iterator, not confirmation that an equal value exists.

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

std::make_heap — building a heap from a range

std::make_heap rearranges a range into a heap in linear time. By default, the largest element moves to the front; a custom comparator can create a min-heap. The resulting range is not guaranteed to be sorted.

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

std::make_shared — creating an object with shared ownership

std::make_shared creates an object and returns a managing std::shared_ptr. For a non-array type, it forwards arguments to initialize the object. Copies of the pointer share the same object and responsibility for its lifetime.

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

std::make_tuple — creating a tuple with deduced types

std::make_tuple from <tuple> creates a tuple whose element types are deduced from its arguments. It normally stores values, but std::ref and std::cref let you create reference elements instead of copies.

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

std::make_unique — creating an exclusively owned object

std::make_unique from <memory> creates an object or a dynamic array and returns a std::unique_ptr that manages it. Ownership is exclusive, and the memory is automatically released when the owner is destroyed.

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

std::map — an ordered map of unique keys

std::map stores key–value pairs in comparator order, with at most one element for each equivalent key. Learn non-mutating lookup, insertion, erasure, and node transfer, including why operator[] is not a presence check.

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

std::max — selecting the largest value

std::max from <algorithm> selects the larger of two arguments or the largest element of a nonempty initializer list. It supports custom comparison; the two-value overload returns a reference, whereas the list overload returns a copy.

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

std::max_element — iterator to the largest element

std::max_element searches a range and returns an iterator to its first largest element. An empty range yields last; an optional comparator determines the ordering.

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

std::memcpy — copying memory bytes

std::memcpy from <cstring> copies a specified number of bytes between non-overlapping memory regions. It does not check bounds and is not a replacement for copying resource-owning objects.

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

std::memory_order — ordering atomic operations

std::memory_order from <atomic> specifies ordering and synchronization for atomic operations. It distinguishes atomicity alone from safely publishing data between threads; incorrectly weakening an order can introduce a data race.

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

std::merge — stable merging of sorted ranges

std::merge from <algorithm> copies two sorted ranges into a separate output range. It preserves duplicates and stability, and returns an iterator one past the last element written.

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

std::min — selecting the smallest value

std::min from <algorithm> selects the smaller of two arguments or the minimum of a nonempty list. The two-argument overload returns a reference, while the list overload returns a copy; an optional comparator defines the ordering.

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

std::min_element — finding the smallest element

std::min_element from <algorithm> returns an iterator to the first smallest element in a range. It does not sort the data. For an empty range it returns last, so check the iterator before reading the result.

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

std::minmax — minimum and maximum

std::minmax from <algorithm> finds the minimum and maximum together. The two-argument overload returns a pair of references, whereas the initializer-list overload returns a pair of copied values.

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

std::minmax_element — positions of the minimum and maximum

std::minmax_element finds a range's minimum and maximum and returns a pair of iterators. Ties select the first minimum and last maximum; an empty range requires checking the result before dereferencing.

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

std::move — a cast that enables moving

std::move from <utility> exposes an object as an xvalue, enabling selection of a move operation. The call itself neither transfers resources nor empties the object; the actual effect depends on the operation that consumes its result.

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

std::move_backward — moving a range from the end

std::move_backward assigns range elements from last to first while preserving their order in the destination. It supports safely shifting an overlapping range to the right.

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

std::move_only_function — a move-only callable wrapper

C++23 std::move_only_function stores a callable with a specified signature, including a lambda owning an exclusive resource. The wrapper can be moved but not copied. It must contain a target before it is called.

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

std::multimap — ordered pairs with duplicate keys

std::multimap from <map> stores key–value pairs in key order and allows multiple elements with equivalent keys. equal_range retrieves the entire matching group, while erase(key) removes every element in that group.

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

std::multiset — an ordered container with duplicates

std::multiset from <set> stores keys in comparator-defined order and permits equivalent keys. Learn how lookup and counting work, and distinguish removing one element from removing every equivalent element.

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

std::mutex — mutual exclusion between threads

std::mutex from <mutex> allows only one thread at a time to own its lock. It protects shared data when all conflicting accesses follow the same locking protocol. std::lock_guard manages lock release within a scope.

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

std::nano — the one-billionth ratio

std::nano is a type alias from <ratio> representing the exact factor 1/1,000,000,000. It exposes the numerator num and denominator den as compile-time constants; it is neither a floating-point number nor a unit of time.

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

std::next — an advanced copy of an iterator

std::next from <iterator> returns a copy of an iterator advanced by n positions, defaulting to one. It also supports iterators without operator +. It does not check range boundaries; a negative offset requires a bidirectional iterator.

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