|
value-preserving-literals 0.0.1
value-preserving literals for C++
|
Untyped integer literal type. More...
#include <val.h>
Public Member Functions | |
| template<__arithmetic _Up> | |
| consteval | operator _Up () const |
| Conversion operator to arithmetic types. | |
Friends | |
| consteval constinteger | operator- (constinteger __v) noexcept |
| Unary negation operator. | |
| consteval constinteger | operator+ (constinteger __v) noexcept |
| Unary plus operator (identity) | |
| consteval constinteger | operator~ (constinteger)=delete("complement cannot be applied to value of unspecified width") |
| Bitwise complement operator (deleted) | |
| consteval constinteger | operator! (constinteger)=delete("explicitly write 1 or 0 instead") |
| Logical NOT operator (deleted) | |
Untyped integer literal type.
Represents an integer value with up to the precision of unsigned long long.
Conversions to arithmetic types are only allowed when they are value-preserving. Otherwise, bad_value_preserving_cast is thrown.
|
inlineconsteval |
Conversion operator to arithmetic types.
Converts to the target type only if the conversion is value-preserving. Checks that the value fits within the target range and can be exactly represented without precision loss.
| _Up | Target arithmetic type |
| bad_value_preserving_cast | if conversion is not value-preserving |
|
friend |
Unary negation operator.
|
friend |
Unary plus operator (identity)
|
friend |
Bitwise complement operator (deleted)
Cannot be applied because the width is unspecified.
|
friend |
Logical NOT operator (deleted)
Explicitly write 1 or 0 instead.