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.
CKTIS / C++
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
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.
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.
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.
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.
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.
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.
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.
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.
std::stop_token lets an operation check whether a stop request has been made. Its stop_requested() member reads shared state; the token itself neither stops a thread nor issues a request.
std::string is an owning, variable-length sequence of char elements. Learn construction, appending, searching, and substring extraction, including the difference between reserve and resize and the rules for safely using data().
std::stringstream from <sstream> formats values as text and reads values from text held in memory. It combines the << and >> operators with a string buffer and stream error state.
std::string_view provides access to text without copying characters or owning their storage. Learn to search with find, create subviews with substr, and check npos while keeping the underlying data alive.
std::strong_ordering from <compare> describes a three-way comparison result: less, equal, or greater. It represents a total order with substitutability of equal values and has no unordered state.
std::suspend_always from <coroutine> is a simple awaitable that suspends a coroutine without producing a value. It does not schedule resumption: managing code must retain a handle and resume or destroy the suspended coroutine.
std::suspend_never from <coroutine> is a trivial awaiter that does not suspend a coroutine and produces no value. It helps specify immediate coroutine startup or completion; at completion, careful attention to coroutine-state lifetime is necessary.
std::swap from <utility> exchanges the values of two objects and returns void. Learn the primary template's requirements, the array overload, and the call pattern that enables ADL in generic code.
std::system_error combines an error code with diagnostic text. It lets low-level errors travel as exceptions while retaining structured information for identifying the cause programmatically.
std::terminate, declared in <exception>, invokes a program-termination handler and never returns. It is triggered by conditions such as an unhandled exception or an exception escaping a noexcept function, and can also be called explicitly. It does not guarantee destructor-based resource cleanup.
std::this_thread::sleep_for blocks the calling thread for a relative interval expressed as std::chrono::duration. It neither creates a thread nor synchronizes access to data. Returning may take longer than the requested interval.
std::this_thread::yield() gives the implementation an opportunity to reschedule threads. It guarantees neither that another thread runs nor any particular waiting time, and it provides no memory synchronization.
std::thread runs a callable in a separate thread. Learn how joinable(), join(), and detach() differ, and why the association with a thread must be resolved before its object is destroyed.
std::tie from <tuple> creates a tuple of lvalue references to existing objects. It lets you assign tuple elements to variables and skip selected positions with std::ignore, without copying the referenced objects.
std::to_chars writes a number's textual representation into a caller-provided buffer. Its result contains an end pointer and an error code; the function does not append a terminating '\0'.
std::tolower from <cctype> converts one character to lowercase according to the current C locale. For char data, convert to unsigned char first and call the function only if the resulting value fits in int.