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::basic_string::substr — owning substring

Extract part of a string into a new owning string. Learn how the length is capped, when the start position throws, and what the C++23 rvalue overload changes.

Advanced · ISO C++23; implementation support may vary
C++

Joining paths with `/` in `std::filesystem`

The path slash operator returns a new path without changing either operand. The right operand’s syntax determines whether it appends to or replaces some or all of the left path.

Advanced · ISO C++23; implementation support may vary
C++

std::ios::boolalpha — read and write Boolean names

Set the `std::ios::boolalpha` flag with `setf` to read and write `bool` values using the stream’s locale-specific names rather than numeric representations.

Advanced · ISO C++23; implementation support may vary
C++

std::nullopt — explicit absence of a value

Use `std::nullopt` to return or set an empty `std::optional` without confusing a missing result with a valid value such as zero.

Advanced · ISO C++23; implementation support may vary
C++

Checking whether float conforms to IEEE 754

Check at compile time whether the implementation’s `float` conforms to IEEE 754, separately from any storage-size or binary-format requirements.

Advanced · ISO C++23; implementation support may vary
C++

std::string::find — first match and npos

Find the index of a character or substring and compare it with `std::string::npos` before using it as an index or copying or changing the text.

Advanced · ISO C++23; implementation support may vary
C++

`std::string::npos`: no match or a count to the end

Compare the result of `std::string::find` with `std::string::npos`. As a count in `substr` or `erase`, the same constant means “through the end,” not a starting position.

Advanced · ISO C++23; implementation support may vary
C++

std::vector::back — access the last element

Use `back()` to read or change the last element of a non-empty vector. Know when the result becomes invalid and why extracting an element from a heap takes two separate steps.

Advanced · ISO C++23; implementation support may vary
C++

std::vector::begin — start of a vector range

`begin()` returns the vector's starting iterator. The vector's constness selects the overload, and `end()` marks the position you must not dereference.

Advanced · ISO C++23; implementation support may vary
C++

std::vector::end — past-the-end iterator

`std::vector::end` returns the position just past the last element, not the last element itself. Use it as an exclusive range boundary and to detect a failed search.

Advanced · ISO C++23; implementation support may vary