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::convertible_to — consistent implicit and explicit conversion

std::convertible_to<From, To>, declared in <concepts>, requires both implicit conversion and conversion through static_cast to To, with consistent results. Merely supporting an explicit cast is not sufficient.

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

std::accumulate: a left fold over a range

std::accumulate combines a half-open range with an initial value and returns the final accumulator. The type of init affects the type and precision of every step.

Intermediate · C++23
C++

std::align_val_t — the memory-alignment argument type

std::align_val_t from <new> carries a required alignment to allocation and deallocation overloads. It is a distinct enumeration type that lets overloads distinguish an alignment argument from a storage-size argument.

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

Atomic shared_ptr stores and loads through free functions

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.

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

std::atomic_thread_fence — synchronization using memory fences

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.

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

std::back_insert_iterator — appending through an output iterator

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.

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

std::bad_alloc — allocation failure exception

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.

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

std::bad_optional_access — exception for empty optional access

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.

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

std::basic_ios::tie — tying a stream to an output stream

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.

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

std::basic_ostream::flush — synchronize the output buffer

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.

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

std::basic_string::operator+= — appending to a string

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.

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