mp_units::treat_as_floating_point¶
Customization point: whether a representation type is treated as floating-point
Synopsis¶
Declared in <mp-units/framework/customization_points.h>
template<typename Rep>
constexpr bool treat_as_floating_point =
std::chrono::treat_as_floating_point_v<detail::value_type_t<Rep>>;
Description¶
A conversion to a floating-point representation is implicit whatever the ratio of the units, as from millimetres to metres, while one to an integral type with a fractional ratio needs a cast. The default asks std::chrono::treat_as_floating_point_v (std::is_floating_point_v in a freestanding build) about the type, or about the type it wraps when representation_underlying_type names one.
A floating-point class type that wraps no fundamental type needs a specialization:
class soft_float; // floating-point arithmetic in software, for a CPU with no FPU
template<>
inline constexpr bool mp_units::treat_as_floating_point<soft_float> = true;
Template Parameters¶
| Name | Description |
|---|---|
| Rep | a representation type |
See Also¶
- Representation Types in the User's Guide