deprecated.h File
C++ header file with declarations for the deprecated µTest++ definitions. More...
Included Headers
Namespaces Index
| namespace | micro_os_plus |
|
The primary namespace for the µOS++ framework. More... | |
| namespace | micro_test_plus |
|
Primary namespace for the µTest++ testing framework. More... | |
| namespace | detail |
|
Internal implementation details for the µTest++ framework. More... | |
| namespace | math |
|
Internal mathematical utilities for the µTest++ testing framework. More... | |
| namespace | literals |
|
Deprecated user-defined literals of the test checks. More... | |
| namespace | operators |
|
Deprecated comparison and logical operators of the test checks. More... | |
| namespace | reflection |
|
Reflection utilities for the µTest++ testing framework. More... | |
| namespace | type_traits |
|
Deprecated v5.0.1 namespace of the concepts and of the value wrapper templates. More... | |
Classes Index
| struct | floating_point_constant<T, N, D, Size, P> |
|
Struct template representing a generic floating-point constant with custom size and precision. More... | |
| struct | floating_point_constant<T, N, D, Size, P> |
|
Struct template representing a generic floating-point constant with custom size and precision. More... | |
| struct | function_traits<T> |
|
Deprecated traits of the callable objects. More... | |
| struct | function_traits<R(*)(Args_T...)> |
|
Deprecated traits of the function pointers. More... | |
| struct | function_traits<R(Args_T...)> |
|
Deprecated traits of the function types. More... | |
| struct | function_traits<R(T::*)(Args_T...) const> |
|
Deprecated traits of the pointers to const member functions. More... | |
| struct | function_traits<R(T::*)(Args_T...)> |
|
Deprecated traits of the pointers to member functions. More... | |
| struct | identity<T, Extra> |
|
Deprecated identity type. More... | |
| struct | integer_literal |
|
The result of parsing the characters of an integer literal. More... | |
| struct | integral_constant<N> |
|
Struct template representing a generic integral constant. More... | |
| struct | integral_constant<N> |
|
Struct template representing a generic integral constant. More... | |
| struct | integral_min_magnitude<T> |
|
Struct template representing the absolute value of the minimum of a signed integral type, as written in a literal. More... | |
| struct | list<Types> |
|
Deprecated empty type list. More... | |
| struct | named_bool |
|
Struct representing a named boolean constant, created by the _b literal. More... | |
| struct | op |
|
Empty base struct for the framework expression types. More... | |
| class | timestamp |
|
Deprecated clock reading. More... | |
| struct | to_t<T> |
|
Deprecated generic strongly-typed wrapper for explicit type conversion. More... | |
| struct | value<T> |
|
Struct template representing a generic value, accessible via a getter. More... | |
| struct | value<T> |
|
Struct template representing a generic value, accessible via a getter. More... | |
| struct | value<T> |
|
Struct template representing a floating-point value with precision control. More... | |
| struct | value_base<T> |
|
Base struct template providing common storage and accessors for run-time value-wrapper types. More... | |
Concepts Index
| concept | has_npos |
|
Deprecated concept satisfied when T provides a npos member. More... | |
| concept | has_value |
|
Deprecated concept satisfied when T has a member named value. More... | |
| concept | is_floating_point |
|
Deprecated concept satisfied when T is a floating-point type. More... | |
Typedefs Index
template <class T> | |
| using | genuine_integral_value = detail::value< T > |
|
Deprecated integral value wrapper. More... | |
| using | runner_totals = counters |
| using | static_runner = runner |
| using | subtest = test_case |
| using | timestamps = stopwatch |
template <class T> | |
| using | value_base_ = detail::value_base< T > |
|
Deprecated name of detail::value_base. More... | |
Operators Index
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | operator and (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Deprecated logical && (and) operator. More... | |
template <class T> | |
| constexpr auto | operator not (T &&t) |
|
Deprecated logical ! (not) operator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | operator or (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Deprecated logical || (or) operator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | operator!= (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Deprecated non-equality operator. More... | |
| constexpr auto | operator""_b (const char *name, decltype(sizeof("")) size) |
|
Deprecated user-defined literal operator to create a named boolean constant. More... | |
template <char... Cs> | |
| constexpr auto | operator""_c () |
|
Deprecated user-defined literal operator to convert to char. More... | |
template <char... Cs> | |
| constexpr auto | operator""_d () |
|
Deprecated user-defined literal operator to convert to double. More... | |
template <char... Cs> | |
| constexpr auto | operator""_f () |
|
Deprecated user-defined literal operator to convert to float. More... | |
template <char... Cs> | |
| constexpr auto | operator""_i () |
|
Deprecated user-defined literal operator to convert to int. More... | |
template <char... Cs> | |
| constexpr auto | operator""_i16 () |
|
Deprecated user-defined literal operator to convert to int16_t. More... | |
template <char... Cs> | |
| constexpr auto | operator""_i32 () |
|
Deprecated user-defined literal operator to convert to int32_t. More... | |
template <char... Cs> | |
| constexpr auto | operator""_i64 () |
|
Deprecated user-defined literal operator to convert to int64_t. More... | |
template <char... Cs> | |
| constexpr auto | operator""_i8 () |
|
Deprecated user-defined literal operator to convert to int8_t. More... | |
template <char... Cs> | |
| constexpr auto | operator""_l () |
|
Deprecated user-defined literal operator to convert to long. More... | |
template <char... Cs> | |
| constexpr auto | operator""_ld () |
|
Deprecated user-defined literal operator to convert to long double. More... | |
template <char... Cs> | |
| constexpr auto | operator""_ll () |
|
Deprecated user-defined literal operator to convert to long long. More... | |
template <char... Cs> | |
| constexpr auto | operator""_s () |
|
Deprecated user-defined literal operator to convert to short. More... | |
template <char... Cs> | |
| constexpr auto | operator""_sc () |
|
Deprecated user-defined literal operator to convert to signed char. More... | |
template <char... Cs> | |
| constexpr auto | operator""_u () |
|
Deprecated user-defined literal operator to convert to unsigned. More... | |
template <char... Cs> | |
| constexpr auto | operator""_u16 () |
|
Deprecated user-defined literal operator to convert to uint16_t. More... | |
template <char... Cs> | |
| constexpr auto | operator""_u32 () |
|
Deprecated user-defined literal operator to convert to uint32_t. More... | |
template <char... Cs> | |
| constexpr auto | operator""_u64 () |
|
Deprecated user-defined literal operator to convert to uint64_t. More... | |
template <char... Cs> | |
| constexpr auto | operator""_u8 () |
|
Deprecated user-defined literal operator to convert to uint8_t. More... | |
template <char... Cs> | |
| constexpr auto | operator""_uc () |
|
Deprecated user-defined literal operator to convert to unsigned char. More... | |
template <char... Cs> | |
| constexpr auto | operator""_ul () |
|
Deprecated user-defined literal operator to convert to unsigned long. More... | |
template <char... Cs> | |
| constexpr auto | operator""_ull () |
|
Deprecated user-defined literal operator to convert to unsigned long long. More... | |
template <char... Cs> | |
| constexpr auto | operator""_us () |
|
Deprecated user-defined literal operator to convert to unsigned short. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | operator< (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Deprecated less than operator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | operator<= (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Deprecated less than or equal operator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | operator== (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Deprecated equality operator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | operator> (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Deprecated greater than operator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | operator>= (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Deprecated greater than or equal operator. More... | |
Functions Index
template <class T, class Value_T> | |
| constexpr T | count_decimals (Value_T value) |
|
Computes the number of decimal places of a value, with a precision of about seven digits. More... | |
template <bool Fraction, char... Cs> | |
| std::size_t | count_literal_digits (void) |
|
Counts the decimal digits of a floating-point literal, before or after the decimal point. More... | |
template <class Value_T> | |
| constexpr Value_T | decimal_epsilon (Value_T value) |
|
Computes the default comparison tolerance of a floating-point value, one unit of its last decimal. More... | |
template <class T, char... Cs> | |
| T | den (void) |
|
Computes the decimal part of a number represented as an array of characters. More... | |
template <class T, char... Cs> | |
| T | den_size (void) |
|
Counts the decimal places of a number represented as an array of characters. More... | |
template <class T, char... Cs> | |
| unsigned long long | integer_magnitude (void) |
|
Computes the value of an integer literal of type T, before any negation. More... | |
template <class T, char... Cs> | |
| constexpr auto | integral_literal (void) |
|
Creates the compile-time constant of an integer literal. More... | |
template <class T, char... Cs> | |
| T | num (void) |
|
Computes the integral part of a decimal floating-point number represented as an array of characters. More... | |
template <char... Cs> | |
| integer_literal | parse_integer_literal (void) |
|
Parses the characters of an integer literal. More... | |
template <class T, class Exp_T> | |
| constexpr T | pow (const T base, const Exp_T exp) noexcept |
|
Generic exponentiation function to compute the power of a base raised to an exponent. More... | |
| const char * | short_name (const char *name) noexcept |
|
Deprecated extraction of the file name from a path. More... | |
Value Wrappers Index
| using | to_b = detail::value< bool > |
|
Deprecated strongly-typed wrapper for bool values. More... | |
| using | to_c = detail::value< char > |
|
Deprecated strongly-typed wrapper for char values. More... | |
| using | to_d = detail::value< double > |
|
Deprecated strongly-typed wrapper for double values. More... | |
| using | to_f = detail::value< float > |
|
Deprecated strongly-typed wrapper for float values. More... | |
| using | to_i = detail::value< int > |
|
Deprecated strongly-typed wrapper for int values. More... | |
| using | to_i16 = detail::value< std::int16_t > |
|
Deprecated strongly-typed wrapper for std::int16_t values. More... | |
| using | to_i32 = detail::value< std::int32_t > |
|
Deprecated strongly-typed wrapper for std::int32_t values. More... | |
| using | to_i64 = detail::value< std::int64_t > |
|
Deprecated strongly-typed wrapper for std::int64_t values. More... | |
| using | to_i8 = detail::value< std::int8_t > |
|
Deprecated strongly-typed wrapper for std::int8_t values. More... | |
| using | to_l = detail::value< long > |
|
Deprecated strongly-typed wrapper for long values. More... | |
| using | to_ld = detail::value< long double > |
|
Deprecated strongly-typed wrapper for long double values. More... | |
| using | to_ll = detail::value< long long > |
|
Deprecated strongly-typed wrapper for long long values. More... | |
| using | to_s = detail::value< short > |
|
Deprecated strongly-typed wrapper for short values. More... | |
| using | to_sc = detail::value< signed char > |
|
Deprecated strongly-typed wrapper for signed char values. More... | |
| using | to_u = detail::value< unsigned > |
|
Deprecated strongly-typed wrapper for unsigned values. More... | |
| using | to_u16 = detail::value< std::uint16_t > |
|
Deprecated strongly-typed wrapper for std::uint16_t values. More... | |
| using | to_u32 = detail::value< std::uint32_t > |
|
Deprecated strongly-typed wrapper for std::uint32_t values. More... | |
| using | to_u64 = detail::value< std::uint64_t > |
|
Deprecated strongly-typed wrapper for std::uint64_t values. More... | |
| using | to_u8 = detail::value< std::uint8_t > |
|
Deprecated strongly-typed wrapper for std::uint8_t values. More... | |
| using | to_uc = detail::value< unsigned char > |
|
Deprecated strongly-typed wrapper for unsigned char values. More... | |
| using | to_ul = detail::value< unsigned long > |
|
Deprecated strongly-typed wrapper for unsigned long values. More... | |
| using | to_ull = detail::value< unsigned long long > |
|
Deprecated strongly-typed wrapper for unsigned long long values. More... | |
| using | to_us = detail::value< unsigned short > |
|
Deprecated strongly-typed wrapper for unsigned short values. More... | |
Deprecated Value Wrappers Index
| using | _b = to_b |
|
Deprecated strongly-typed wrapper for bool values, the v5.0.1 name of to_b. More... | |
| using | _c = to_c |
|
Deprecated strongly-typed wrapper for char values, the v5.0.1 name of to_c. More... | |
| using | _d = to_d |
|
Deprecated strongly-typed wrapper for double values, the v5.0.1 name of to_d. More... | |
| using | _f = to_f |
|
Deprecated strongly-typed wrapper for float values, the v5.0.1 name of to_f. More... | |
| using | _i = to_i |
|
Deprecated strongly-typed wrapper for int values, the v5.0.1 name of to_i. More... | |
| using | _i16 = to_i16 |
|
Deprecated strongly-typed wrapper for std::int16_t values, the v5.0.1 name of to_i16. More... | |
| using | _i32 = to_i32 |
|
Deprecated strongly-typed wrapper for std::int32_t values, the v5.0.1 name of to_i32. More... | |
| using | _i64 = to_i64 |
|
Deprecated strongly-typed wrapper for std::int64_t values, the v5.0.1 name of to_i64. More... | |
| using | _i8 = to_i8 |
|
Deprecated strongly-typed wrapper for std::int8_t values, the v5.0.1 name of to_i8. More... | |
| using | _l = to_l |
|
Deprecated strongly-typed wrapper for long values, the v5.0.1 name of to_l. More... | |
| using | _ld = to_ld |
|
Deprecated strongly-typed wrapper for long double values, the v5.0.1 name of to_ld. More... | |
| using | _ll = to_ll |
|
Deprecated strongly-typed wrapper for long long values, the v5.0.1 name of to_ll. More... | |
| using | _s = to_s |
|
Deprecated strongly-typed wrapper for short values, the v5.0.1 name of to_s. More... | |
| using | _sc = to_sc |
|
Deprecated strongly-typed wrapper for signed char values, the v5.0.1 name of to_sc. More... | |
template <class T> | |
| using | _t = to_t< T > |
|
Deprecated generic strongly-typed wrapper, the v5.0.1 name of to_t. More... | |
| using | _u = to_u |
|
Deprecated strongly-typed wrapper for unsigned values, the v5.0.1 name of to_u. More... | |
| using | _u16 = to_u16 |
|
Deprecated strongly-typed wrapper for std::uint16_t values, the v5.0.1 name of to_u16. More... | |
| using | _u32 = to_u32 |
|
Deprecated strongly-typed wrapper for std::uint32_t values, the v5.0.1 name of to_u32. More... | |
| using | _u64 = to_u64 |
|
Deprecated strongly-typed wrapper for std::uint64_t values, the v5.0.1 name of to_u64. More... | |
| using | _u8 = to_u8 |
|
Deprecated strongly-typed wrapper for std::uint8_t values, the v5.0.1 name of to_u8. More... | |
| using | _uc = to_uc |
|
Deprecated strongly-typed wrapper for unsigned char values, the v5.0.1 name of to_uc. More... | |
| using | _ul = to_ul |
|
Deprecated strongly-typed wrapper for unsigned long values, the v5.0.1 name of to_ul. More... | |
| using | _ull = to_ull |
|
Deprecated strongly-typed wrapper for unsigned long long values, the v5.0.1 name of to_ull. More... | |
| using | _us = to_us |
|
Deprecated strongly-typed wrapper for unsigned short values, the v5.0.1 name of to_us. More... | |
Deprecated Functions Index
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | _and (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Deprecated generic logical and operation, the v5.0.1 name of all_of(). More... | |
template <class Expr_T> | |
| constexpr auto | _not (Expr_T &&expr) |
|
Deprecated generic logical not operation, the v5.0.1 name of negate(). More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | _or (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Deprecated generic logical (inclusive) or operation, the v5.0.1 name of any_of(). More... | |
template <class T> | |
| constexpr auto | approx (T value, std::type_identity_t< T > epsilon) noexcept -> detail::value< T > |
|
Deprecated wrapping of a floating-point value with an explicit comparison tolerance. More... | |
template <class T> | |
| constexpr T & | mut (const T &t) noexcept |
|
Deprecated generic mutator to remove const qualification from a reference. More... | |
Description
C++ header file with declarations for the deprecated µTest++ definitions.
This header groups the deprecated definitions that are not members of the framework classes, kept for compatibility with the applications written for the previous versions:
- the v5.0.1 names of the logical functions (_not, _and, and _or);
- the mut() helper, not used by the framework;
- the overloaded operators of the operators namespace, the user-defined literals of the literals namespace, the to_* type wrappers, to_t<T>, and approx (value, epsilon), deprecated since 6.0.0 in favour of the function comparators;
- the v5.0.1 names of the value wrappers (_i, _u8, etc.);
- the v5.0.1 names of the classes (subtest, static_runner, detail::runner_totals, and detail::timestamps);
- the detail::timestamp class;
- the reflection::short_name() function;
- the v5.0.1 type_traits namespace.
The deprecated member functions and data members remain in the declarations of their classes, since C++ does not allow them to be declared elsewhere.
All the deprecated definitions, in this header and in the classes, are available only when MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED is defined; without it, the applications that still use them fail to compile.
Keeping the deprecated definitions separate makes them easy to identify and, in a future major release, to remove.
All definitions reside within the micro_os_plus::micro_test_plus namespace.
This file is included by micro-os-plus/micro-test-plus.h, which is the header that the applications include.
Functions
count_decimals()
| nodiscard constexpr |
Computes the number of decimal places of a value, with a precision of about seven digits.
- Template Parameters
-
T The integral type for the result.
Value_T The type of the input value, a floating-point type.
- Parameters
-
value The value whose decimal precision is to be determined; it may be negative, infinite, or a NaN.
- Returns
The number of decimal places, as a value of type T, at least one, or zero for a zero value; the leading zeros of a value below one are counted; it is limited by the magnitude from which Value_T represents only integers.
This function template determines the number of decimal (fractional) digits present in a floating-point value, with a precision of about seven digits. Being constexpr, it can also be evaluated at compile time.
The function repeatedly multiplies the absolute value by ten, incrementing a counter until the distance to the nearest integer is at most a defined precision threshold (1e-7). Using the distance to the nearest integer, not the fractional part, prevents the rounding noise of a value just below an integer (e.g. 2674.9999999999995) from being taken as more decimals.
The nearest integer is never zero: while the scaled value is below one, its distance to one is used, so that the leading zeros of a small value are counted as decimals, as in its notation (12 for 1e-12), instead of the count stopping as soon as the scaled value is below the threshold. A zero value has no significant digit, and the result is zero.
The loop also stops when the value reaches the magnitude from which the type can represent only integers (2^23 for float, 2^52 for double), limited to 2^63 so that the conversion to unsigned long long is always defined. This bounds the number of steps for large values, infinities, and NaNs, for which the result is one; for small values, the number of steps is bounded by the decimal exponent of the smallest value of the type.
Definition at line 258 of file deprecated-inlines.h.
References micro_os_plus::micro_test_plus::detail::math::abs, micro_os_plus::micro_test_plus::detail::math::count_decimals and micro_os_plus::micro_test_plus::detail::math::min_value.
Referenced by micro_os_plus::micro_test_plus::detail::math::count_decimals and micro_os_plus::micro_test_plus::detail::math::decimal_epsilon.
count_literal_digits()
| nodiscard |
Counts the decimal digits of a floating-point literal, before or after the decimal point.
The digit separators (') are not counted.
- Template Parameters
-
Fraction true to count the digits after the decimal point, false to count those before it.
Cs The characters of the literal.
- Parameters
None.
- Returns
The number of digits.
Walks the characters once, counting the decimal digits before the first decimal point (Fraction false) or after it (Fraction true); the digit separators are skipped.
Definition at line 101 of file deprecated-inlines.h.
Reference micro_os_plus::micro_test_plus::detail::math::count_literal_digits.
Referenced by micro_os_plus::micro_test_plus::detail::math::count_literal_digits, micro_os_plus::micro_test_plus::detail::math::den, micro_os_plus::micro_test_plus::detail::math::den_size and micro_os_plus::micro_test_plus::detail::math::num.
decimal_epsilon()
| nodiscard constexpr |
Computes the default comparison tolerance of a floating-point value, one unit of its last decimal.
- Template Parameters
-
Value_T The type of the value, a floating-point type.
- Parameters
-
value The value whose tolerance is to be determined; it may be negative, infinite, or a NaN.
- Returns
Ten raised to minus the number of decimal places returned by count_decimals() (0.01 for 1.25, 1e-12 for 1e-12), or zero, which means an exact comparison, for a zero value and for a value whose tolerance would be below the range of Value_T.
The number of decimal places is computed by count_decimals(), and the tolerance is one divided by ten raised to that number, as for the floating-point literals, which use the decimals written.
A zero value has no decimals, and gets a zero tolerance, so that it is compared exactly; a tolerance of one unit of an arbitrary decimal would make the zero equal to unrelated small values. A zero tolerance is also returned when ten raised to the number of decimals would exceed the range of Value_T (values below about 1e-308 for double), instead of computing an infinite power.
Definition at line 326 of file deprecated-inlines.h.
References micro_os_plus::micro_test_plus::detail::math::count_decimals, micro_os_plus::micro_test_plus::detail::math::decimal_epsilon and micro_os_plus::micro_test_plus::detail::math::pow.
Referenced by micro_os_plus::micro_test_plus::detail::math::decimal_epsilon.
den()
| nodiscard |
Computes the decimal part of a number represented as an array of characters.
- Template Parameters
-
T The target integral type for the result.
Cs The character pack representing the numeric value; it must contain a decimal point.
- Parameters
None.
- Returns
The digits after the decimal point, as an integral value of type T (e.g. 25 for 1.25), to be divided by ten raised to the power returned by den_size().
This function template performs compile-time extraction of the decimal (fractional) part from a sequence of characters, typically provided as a template parameter pack.
The function expects the character sequence to represent a numeric value, where all characters are either digits, a dot (.), or an apostrophe ('). Parsing begins after the first dot, accumulating the decimal digits as an integer value and skipping the digit separators (e.g. 1.25 yields 25), so that den() / 10^den_size() gives the fraction. If the result could exceed T, the compilation fails with an explicit message.
Definition at line 177 of file deprecated-inlines.h.
References micro_os_plus::micro_test_plus::detail::math::count_literal_digits and micro_os_plus::micro_test_plus::detail::math::den.
Referenced by micro_os_plus::micro_test_plus::detail::math::den, micro_os_plus::micro_test_plus::literals::operator""_d, micro_os_plus::micro_test_plus::literals::operator""_f and micro_os_plus::micro_test_plus::literals::operator""_ld.
den_size()
| nodiscard |
Counts the decimal places of a number represented as an array of characters.
- Template Parameters
-
T The integral type for the result.
Cs The character pack representing the numeric value; it must contain a decimal point.
- Parameters
None.
- Returns
The number of decimal places (e.g. 2 for 1.25), as a value of type T; it is the scale of the value returned by den().
This function template determines, at compile time, the number of decimal (fractional) digits present in a numeric value represented by a character sequence, typically provided as a template parameter pack.
The function expects the character sequence to represent a numeric value, where all characters are either digits, a dot (.), or an apostrophe ('). It returns the number of digits that follow the first dot (the digit separators are not counted; e.g. 2 for 1.25), which is the scale of the value returned by den().
Definition at line 220 of file deprecated-inlines.h.
References micro_os_plus::micro_test_plus::detail::math::count_literal_digits and micro_os_plus::micro_test_plus::detail::math::den_size.
Referenced by micro_os_plus::micro_test_plus::detail::math::den_size, micro_os_plus::micro_test_plus::literals::operator""_d, micro_os_plus::micro_test_plus::literals::operator""_f and micro_os_plus::micro_test_plus::literals::operator""_ld.
integer_magnitude()
| nodiscard |
Computes the value of an integer literal of type T, before any negation.
- Template Parameters
-
T The integral type of the literal.
Cs The characters of the literal, as received by a literal operator template.
- Parameters
None.
- Returns
The value of the literal, up to max() of T, or, for the signed types, up to max () + 1, the absolute value of the minimum.
The literal must be an integer literal, in any of the C++ forms (decimal, hexadecimal, binary, or octal, with digit separators), and its value must fit in T; otherwise the compilation fails with an explicit message.
Negative values are obtained with the unary minus, so the literal itself is never negative. For the signed types, the limit is the absolute value of the minimum, max () + 1, so that the minimum can be written (e.g. -128_i8); the caller allows this magnitude only when it is negated.
When a check fails, zero is returned, so that the callers report no further errors.
Definition at line 448 of file deprecated-inlines.h.
References micro_os_plus::micro_test_plus::detail::math::integer_magnitude, micro_os_plus::micro_test_plus::detail::math::integer_literal::is_integer, micro_os_plus::micro_test_plus::detail::math::integer_literal::is_too_large, micro_os_plus::micro_test_plus::detail::math::parse_integer_literal and micro_os_plus::micro_test_plus::detail::math::integer_literal::value.
Referenced by micro_os_plus::micro_test_plus::detail::math::integer_magnitude and micro_os_plus::micro_test_plus::detail::integral_literal.
integral_literal()
| nodiscard constexpr |
Creates the compile-time constant of an integer literal.
- Template Parameters
-
T The integral type of the literal.
Cs The characters of the literal, as received by a literal operator template.
Used by the integer literal operators (_i, _u8, etc.).
- Parameters
None.
- Returns
An integral_constant with the value of the literal, or, when the value is the absolute value of the minimum of a signed T, an integral_min_magnitude<T>, valid only when negated.
The value is checked by math::integer_magnitude(), which accepts, for the signed types, the absolute value of the minimum; this value does not fit in T, so it is represented by integral_min_magnitude<T>.
Definition at line 581 of file deprecated-inlines.h.
References micro_os_plus::micro_test_plus::detail::integral_constant< N >::integral_constant, micro_os_plus::micro_test_plus::detail::math::integer_magnitude and micro_os_plus::micro_test_plus::detail::integral_literal.
Referenced by micro_os_plus::micro_test_plus::detail::integral_literal, micro_os_plus::micro_test_plus::literals::operator""_c, micro_os_plus::micro_test_plus::literals::operator""_i, micro_os_plus::micro_test_plus::literals::operator""_i16, micro_os_plus::micro_test_plus::literals::operator""_i32, micro_os_plus::micro_test_plus::literals::operator""_i64, micro_os_plus::micro_test_plus::literals::operator""_i8, micro_os_plus::micro_test_plus::literals::operator""_l, micro_os_plus::micro_test_plus::literals::operator""_ll, micro_os_plus::micro_test_plus::literals::operator""_s, micro_os_plus::micro_test_plus::literals::operator""_sc, micro_os_plus::micro_test_plus::literals::operator""_u, micro_os_plus::micro_test_plus::literals::operator""_u16, micro_os_plus::micro_test_plus::literals::operator""_u32, micro_os_plus::micro_test_plus::literals::operator""_u64, micro_os_plus::micro_test_plus::literals::operator""_u8, micro_os_plus::micro_test_plus::literals::operator""_uc, micro_os_plus::micro_test_plus::literals::operator""_ul, micro_os_plus::micro_test_plus::literals::operator""_ull and micro_os_plus::micro_test_plus::literals::operator""_us.
num()
| nodiscard |
Computes the integral part of a decimal floating-point number represented as an array of characters.
Used by the floating-point literal operators; the integer literals use integer_magnitude(), which also accepts the C++ prefixes and checks the range.
- Template Parameters
-
T The target integral type for the result.
Cs The character pack representing the numeric value.
- Parameters
None.
- Returns
The parsed integral value of type T.
This function template performs compile-time parsing of a numeric value from a sequence of characters, typically provided as a template parameter pack.
The characters must be decimal digits, a dot (.), or digit separators ('), which are skipped; otherwise (e.g. an exponent) the compilation fails with an explicit message, as it does if the integral part has more digits than T can always hold. Parsing stops at the first dot, allowing the function to extract only the integral part of the number.
Definition at line 134 of file deprecated-inlines.h.
References micro_os_plus::micro_test_plus::detail::math::count_literal_digits and micro_os_plus::micro_test_plus::detail::math::num.
Referenced by micro_os_plus::micro_test_plus::detail::math::num, micro_os_plus::micro_test_plus::literals::operator""_d, micro_os_plus::micro_test_plus::literals::operator""_f and micro_os_plus::micro_test_plus::literals::operator""_ld.
parse_integer_literal()
| nodiscard |
Parses the characters of an integer literal.
- Template Parameters
-
Cs The characters of the literal, as received by a literal operator template.
- Parameters
None.
- Returns
The value, and whether the characters form an integer literal and whether its value fits in unsigned long long.
The characters are those of a valid C++ literal, already checked by the compiler (digits valid for the base, digit separators in valid positions). The base is given by the prefix: 0x or 0X for hexadecimal, 0b or 0B for binary, a leading 0 for octal, and none for decimal. The digit separators (') are skipped.
Any other character (a decimal point, an exponent, or a digit not valid for the base, as in the floating-point literal 09.5) marks the literal as not an integer. The value is accumulated in unsigned long long, and the accumulation stops if it would overflow.
Definition at line 354 of file deprecated-inlines.h.
Reference micro_os_plus::micro_test_plus::detail::math::parse_integer_literal.
Referenced by micro_os_plus::micro_test_plus::detail::math::integer_magnitude and micro_os_plus::micro_test_plus::detail::math::parse_integer_literal.
pow()
| nodiscard constexpr noexcept |
Generic exponentiation function to compute the power of a base raised to an exponent.
- Template Parameters
-
T The type of the base value. Must support multiplication assignment and construction from an integer.
Exp_T The type of the exponent. Must be default-constructible (to zero), and support the < and prefix ++ operators.
- Parameters
-
base The base value to be raised to the power of exp.
exp The exponent value.
- Returns
The result of raising base to the power of exp.
This function template provides a constexpr implementation for raising a base value to a given exponent, supporting any types that allow multiplication.
The function starts from one and multiplies the result by the base exp times. If the exponent is zero (or negative), the function returns one (the multiplicative identity for the type).
Definition at line 85 of file deprecated-inlines.h.
Reference micro_os_plus::micro_test_plus::detail::math::pow.
Referenced by micro_os_plus::micro_test_plus::detail::math::decimal_epsilon and micro_os_plus::micro_test_plus::detail::math::pow.
File Listing
The file content with the documentation metadata removed is:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.