user-defined
literals
More...
◆ operator""_cnl()
template<char... Chars>
constexpr auto cnl::literals::operator""_cnl |
( |
| ) |
|
|
constexpr |
generate an elastic_scaled_integer object using a literal
- Template Parameters
-
Digits | the characters of the literal sequence |
- Returns
- the given value to be represented using an elastic_scaled_integer type
- Note
- The return type is guaranteed to be no larger than is necessary to represent the maximum value of Integral.
- Example
To define a decimal fixed-point object with value 3.141:
constexpr auto n = 3.141_cnl;
static_assert(n == 3.141);
static_assert(
decltype(n)>::value);
◆ operator""_cnl2()
template<char... Chars>
constexpr auto cnl::literals::operator""_cnl2 |
( |
| ) |
|
|
constexpr |
generate an elastic_scaled_integer object using a binary literal
- Template Parameters
-
Digits | the characters of the literal sequence |
- Precondition
- Sequence must be representable using binary fractions. E.g.
0.1_cnl2
cannot be represented using binary fixed-point numbers. This will not compile.
- Returns
- the given value to be represented using an elastic_scaled_integer type
- Note
- The return type is guaranteed to be no larger than is necessary to represent the maximum value of Integral.