Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Knowledge base

Knowledge base

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 5788

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
C++

std::cout: writing standard output

std::cout is an output-stream object declared in iostream. The << operator sends it values, using formatting appropriate to their types.

Basic · C++23
C++

std::current_exception — retain the handled exception

std::current_exception from <exception> returns a std::exception_ptr referring to the currently handled exception or a copy. It lets you retain an exception and rethrow it later; with no handled exception, it returns a null value.

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

std::dec — decimal integer formatting for streams

std::dec selects base 10 for formatted integer output and input in a C++ stream. The change remains active for subsequent operations until the stream's numeric base setting is changed again.

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

std::declval — inspect expressions without constructing an object

std::declval from <utility> lets you inspect an expression's type without constructing an object. Use it in unevaluated operands, such as decltype; it must not be used for an actual evaluated call.

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

std::default_sentinel_t — range-end marker

std::default_sentinel_t is an empty range-end marker type from <iterator>. It works with iterators that can determine the end themselves, such as std::counted_iterator. It is not a universal replacement for end().

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