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::runtime_error — runtime error exception

std::runtime_error, declared in <stdexcept>, reports errors detectable during program execution. It carries a message accessible through what() and publicly derives from std::exception.

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

std::scoped_lock — scope-bound lock ownership

std::scoped_lock owns mutex locks for its object's lifetime. Its constructor locks the supplied mutexes, and its destructor unlocks them. For multiple mutexes, it uses std::lock to avoid deadlock while acquiring them together.

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

std::set — an ordered collection of unique keys

std::set from <set> stores unique keys in comparator order. Learn insertion, lookup, and the differences between find, contains, count, and equal_range, including how to check end() safely.

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

std::set_difference — difference of sorted ranges

std::set_difference copies the difference of two sorted ranges into a separate destination. It accounts for duplicates: each equivalent occurrence in the second range cancels one occurrence from the first range's result.

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

std::setfill — output field fill character

std::setfill from <iomanip> sets the character used to pad fields during formatted output. It works with a field width, for example one set by std::setw, and its setting remains active until changed again.

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

std::set_intersection — intersection of sorted ranges

std::set_intersection copies the common elements of two sorted ranges to a separate destination. It retains duplicates according to the smaller occurrence count, rather than producing only unique values.

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

std::setprecision — numeric formatting precision

std::setprecision from <iomanip> sets a stream's precision. With std::defaultfloat, a positive precision sets the maximum number of significant digits. With std::fixed and std::scientific, a nonnegative precision sets the number of digits after the decimal separator, while a negative precision gives the default of six. The setting remains active for subsequent operations.

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

std::set_symmetric_difference — symmetric difference of sorted ranges

std::set_symmetric_difference writes the sorted symmetric difference of two sorted ranges. It accounts for duplicate counts, accepts an output iterator, and returns an iterator past the elements written.

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

std::set_union — union of sorted ranges

std::set_union writes the sorted union of two sorted ranges. It preserves the maximum occurrence count of equivalent elements across the inputs, so the result does not necessarily contain only unique values.

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

std::setw — setting stream field width

std::setw(n), declared in <iomanip>, sets a stream's field width. On output, shorter values are padded and longer values are not truncated. Reapply the width for successive fields because output operations can reset it.

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

std::shared_future — shared access to a result

std::shared_future lets multiple consumers access one result or exception. It is copyable and supports repeated get() calls; wait() waits for readiness, while wait_for() checks readiness with a timeout.

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

std::shared_lock — managing shared lock ownership

std::shared_lock from <shared_mutex> manages shared lock ownership using RAII. It supports concurrent reading by multiple threads, but does not provide the exclusive ownership needed to modify shared data.

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

std::shared_mutex — shared and exclusive locking

std::shared_mutex lets multiple threads hold shared ownership simultaneously or one thread hold exclusive ownership. Use std::shared_lock for reading and std::unique_lock for writing, following the same protocol for every access to the protected data.

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

std::shared_ptr — shared ownership

std::shared_ptr<T> from <memory> shares ownership of an object. Copies keep it alive, and releasing the last owner triggers cleanup. std::weak_ptr observes the object without extending its lifetime.

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

std::shuffle — randomly rearranging elements

std::shuffle rearranges a range in place using a supplied random number generator. It requires random-access iterators; a fixed seed does not guarantee the same ordering across different standard-library implementations.

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

std::sort: ordering a range

std::sort, declared in algorithm, rearranges elements of a range. It requires random-access iterators and a comparison that establishes a strict weak ordering.

Basic · C++23
C++

std::sort_heap — sorting an existing heap

std::sort_heap turns a heap into a sorted range. It requires random-access iterators and a range that is a valid heap under the comparison the function uses; it does not sort arbitrary input directly.

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

std::span — a view over contiguous elements

std::span provides access to contiguous elements without owning them. It lets you pass a range together with its size, while subspan creates a view of part of that range without copying elements.

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

std::stable_partition — stable range partitioning

std::stable_partition rearranges a range so that elements satisfying a predicate precede the others. It preserves relative order within both groups and returns an iterator to the partition boundary.

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

std::stable_sort — stable sorting

std::stable_sort sorts a range while preserving the relative order of elements equivalent under the comparison. It lets you order records by a key without changing the previous order of records with the same key.

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

std::stack — a LIFO container adaptor

std::stack from <stack> provides a LIFO stack: the most recently added element is removed first. The adaptor supports adding elements, inspecting the top, and removing it, but exposes neither iterators nor indexed access.

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

std::stod — convert text to double

std::stod from <string> converts a numeric prefix of text to double. The optional idx parameter identifies where conversion stopped; remaining characters do not automatically cause an error.

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

std::stoi — converting text to int

std::stoi from <string> converts an initial portion of text to int. It lets you specify the numeric base and retrieve the position where conversion stopped. It does not require consuming the entire string and reports errors through exceptions.

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

std::stop_source — a source of stop requests

std::stop_source provides shared stop-request state. get_token() exposes that state for observation, while request_stop() requests stopping. This is a cooperative mechanism: it does not automatically interrupt a running thread.

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