|
value-preserving-literals 0.0.1
value-preserving literals for C++
|
Untyped real literal type. More...
#include <val.h>
Public Member Functions | |
| template<__arithmetic _Up> | |
| consteval | operator _Up () const |
| Conversion operator to arithmetic types. | |
Friends | |
| consteval constreal | operator- (constreal __v) noexcept |
| Unary negation operator. | |
| consteval constreal | operator+ (constreal __v) noexcept |
| Unary plus operator (identity) | |
| consteval constreal | operator~ (constreal)=delete |
| Bitwise complement operator (deleted) | |
| consteval constreal | operator! (constreal)=delete("explicitly write 1 or 0 instead") |
| Logical NOT operator (deleted) | |
Untyped real literal type.
Represents a real value with up to the precision of long double.
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 |
Unary negation operator.
Unary plus operator (identity)
Bitwise complement operator (deleted)
Not applicable to floating-point types.
Logical NOT operator (deleted)
Explicitly write 1 or 0 instead.