std::apply: calling a function with tuple elements
std::apply expands a tuple-like object into the arguments of a callable and returns the result of that invocation.
CKTIS / Knowledge base
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
std::apply expands a tuple-like object into the arguments of a callable and returns the result of that invocation.
std::array is a contiguous container whose element count is known at compile time. It does not allocate a separate dynamic buffer.
std::as_const returns const T& to an existing lvalue without copying. Its rvalue overload is deleted to prevent a dangling reference.
std::async starts a callable according to a std::launch policy and returns a future holding either its result or its exception.
std::atomic provides indivisible loads, stores, and read-modify-write operations on one object and lets code specify memory ordering.
std::atomic_ref creates a non-owning atomic view of an existing trivially copyable object.
The std::shared_ptr overloads of std::atomic_store_explicit and std::atomic_load_explicit atomically replace and retrieve a shared handle. Deprecated in C++23, they protect the handle and ownership, not arbitrary operations on the pointed-to object.
std::atomic_thread_fence establishes memory-ordering constraints without reading or writing a specified object. Inter-thread synchronization requires appropriately connected atomic operations; fences alone are not enough.
std::back_inserter creates an output iterator whose assignment calls push_back on the referenced container.
std::back_insert_iterator is an output iterator adaptor that turns value assignment into a container push_back call. It lets you append elements using *out++ = value without overwriting existing elements.
std::bad_alloc from <new> reports failure to allocate storage. Learn how to catch it by const reference, why what() has no portable fixed text, and how throwing allocation differs from std::nothrow.
std::bad_optional_access is the exception thrown by value() when std::optional contains no value. Distinguish this checked access from the * and -> operators, which require a value to be present.
std::barrier synchronizes a fixed group of participants at each phase boundary and then automatically starts the next phase.
std::basic_ios::tie queries or changes a tied output stream. The tie allows its buffer to be flushed before input; nullptr removes the tie, and the setter overload returns the previous pointer.
std::basic_ostream::flush requests synchronization of a stream buffer and returns a reference to the same stream. It does not append a newline; synchronization failure is reported through badbit.
std::basic_string::operator+= appends characters to an existing string and returns a reference to it. It accepts another string, a single character, a null-terminated string, an initializer list, or a string-view-compatible type.
std::begin provides one way to obtain a container’s first iterator or a pointer to the first element of a built-in array.
std::binary_search returns a boolean indicating whether an ordered range contains an element equivalent to a key.
std::bind_front creates a callable that stores a function and its leading arguments, appending later call arguments after them.
std::bit_cast<To>(from) creates a new object from the source object's bits. Both types must have equal size and be trivially copyable; this is neither a numeric conversion nor access to the source through an alias.
std::bitset<N> stores exactly N bits and provides bit operations, counting, and conversions without dynamic sizing.
std::boolalpha enables textual output and input of bool values on a particular stream. With the classic locale, the names are true and false. The setting remains active until changed.
std::cerr is the narrow output stream associated with stderr, initialized with unitbuf and tied to std::cout.
std::chars_format selects floating-point notation for std::to_chars and parsing rules for std::from_chars. It provides general, fixed, scientific, and hex formats; it does not set precision by itself.