std::getline: read text up to a delimiter
std::getline replaces a std::string with stream characters up to a delimiter that is extracted but not appended.
CKTIS / Knowledge base
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
std::getline replaces a std::string with stream characters up to a delimiter that is extracted but not appended.
std::greater from <functional> creates a callable object that compares operands using >. Learn the distinction between std::greater<T> and the transparent std::greater<>.
std::hash<Key> maps a key to a std::size_t value and is the default hasher for unordered associative containers. Equal keys must have equal hashes, but equal hashes do not prove that the keys are equal.
std::hex selects base 16 for formatted integer output and input on a stream. The setting remains active until changed; it changes neither the numeric value nor the formatting of floating-point numbers.
std::holds_alternative<T> non-throwingly tests whether std::variant currently stores its unique T alternative.
std::ifstream connects character input operations to a file and retains formatting, EOF, and error state.
std::inclusive_scan writes at each position a reduction that includes the current input element and returns the result end.
std::initializer_list<T> accepts brace-enclosed elements as a read-only sequence. Copying the list object neither copies its elements nor extends their lifetime.
std::inner_product combines pairs from two ranges, folds them from init in order, and returns the accumulator.
std::inplace_merge stably merges two consecutive, already sorted subranges into the same range.
std::inserter creates an output iterator that calls the container's insert on each assignment. This lets an algorithm such as std::copy add elements at a chosen position instead of overwriting existing ones.
std::integral from <concepts> checks at compile time whether a type is integral. It includes bool and character types, preserves its result under const and volatile qualification, but rejects references, enumerations, and floating-point types.
std::integral_constant<T, v> represents the constant v of type T as a type. The <type_traits> header also provides std::bool_constant, std::true_type and std::false_type for expressing Boolean results in metaprogramming.
std::invalid_argument from <stdexcept> reports an invalid argument. It carries a diagnostic message available through what() and belongs to the std::logic_error exception hierarchy.
std::invoke calls functions, function objects, and member pointers through one perfect-forwarding interface.
std::ios_base stores a stream's formatting state. Learn how the setf overloads differ, what precision means, and how to enable fixed and boolalpha safely while preserving settings for later restoration.
std::ios_base::sync_with_stdio controls synchronization between the standard C++ streams and C library streams. Calling it with false allows them to operate independently; the function returns the previous state, not a success indicator.
std::iota assigns value to the first element and increments value after each assignment for the next element.
std::isalpha from <cctype> checks whether a value represents a letter under the current C locale. It returns int: zero or a nonzero value. To classify a char value, convert it to unsigned char and pass the result only if it fits in int.
std::is_convertible checks at compile time whether From can be implicitly converted to To. std::is_convertible_v exposes the same bool value without ::value; success does not guarantee value preservation or freedom from exceptions.
std::isdigit from <cctype> checks whether a character is a decimal digit. It returns int, not bool. After converting a character to unsigned char, the resulting value must fit in int.
std::is_heap checks whether a range satisfies the heap property without changing its elements. By default it recognizes a max-heap; a custom comparator lets you check another ordering, such as a min-heap.
This <type_traits> trait checks at compile time whether constructing T from const T& is valid and known not to throw. std::is_nothrow_copy_constructible<T>::value and std::is_nothrow_copy_constructible_v<T> expose the same bool result.
A <type_traits> trait that checks at compile time whether destruction is valid and cannot propagate an exception. std::is_nothrow_destructible<T>::value and std::is_nothrow_destructible_v<T> expose the same bool result.