mp_units::numeric_field¶
Customization point: whether a representation type is real or complex
Synopsis¶
Declared in <mp-units/framework/customization_points.h>
template<typename T>
constexpr utility::unspecified_t numeric_field;
Description¶
A scalar is complex when real() and imag() can be called on it, as members or as free functions found by ADL. A vector or tensor takes the field of its element, so a real matrix that provides element-wise real() and imag(), as Eigen's and Blaze's do, stays real. A vector or tensor of complex elements is complex only when its own type provides real() and imag() too. Otherwise it has no field, and isn't a representation, until it is specialized.
A real scalar that provides real() and imag(), so that code written for complex numbers accepts it, is specialized back to real:
class measured_value; // a real number with `real()` and `imag()`, for generic complex code
template<>
inline constexpr quantity_field mp_units::numeric_field<measured_value> = quantity_field::real;
Template Parameters¶
| Name | Description |
|---|---|
| T | a representation type |
See Also¶
tensor_orderfor whether it is a scalar, a vector, or a tensorquantity_fieldfor the field of a quantityRepresentationOffor how the field of a representation type is matched against a quantity- Representation Types in the User's Guide