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::bit_cast — creating a value from a bit representation

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.

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

std::boolalpha — textual bool values in streams

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.

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

std::chars_format — floating-point conversion format

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.

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

std::chrono::duration_cast — explicit duration conversion

std::chrono::duration_cast converts a duration to a specified std::chrono::duration type. If scaling requires integer division, the quotient is truncated toward zero after the count is converted to a common intermediate type. The function does not check for overflow.

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

std::chrono::weekday — day of the week and c_encoding()

std::chrono::weekday represents a day of the week. Its c_encoding() method returns unsigned: for valid values, 0 means Sunday and 6 means Saturday. Check ok() before interpreting input values.

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

std::chrono::year_month_day — dates and validity checks

std::chrono::year_month_day stores year, month, and day fields. Constructing an object does not guarantee a valid date: ok() also checks month length and leap years.

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

std::cin: reading with error checks

std::cin is the standard input stream. Extraction with >> attempts to interpret input as the requested type, so the result of the operation must be checked.

Basic · C++23