mp_units::utility::radian_of¶
Maps an angle quantity kind to the unit that measures one radian in that kind's system.
Synopsis¶
Declared in <mp-units/utility/polar_vector.h>
template<QuantitySpec auto QS>
requires(QS == get_kind(QS))
constexpr auto radian_of = unspecified;
Description¶
The facades need the radian of whatever angle system a stored angle belongs to, to reach the plain-number std::sin/cos/atan2. This customization point supplies it, keyed on the angle kind. The lookup is radian_of<get_quantity_spec(unit)>, and get_quantity_spec of a bare unit yields a kind_of<...>, so a registration must be keyed on that same kind - the QS == get_kind(QS) constraint enforces this, turning an accidental key on a concrete spec (which would never match) into a clean compile error. The two built-in angle kinds are registered right below: SI's dimensionless angle (si::radian/degree/arcminute/...) and the opt-in strong angular system (angular::radian/degree/...). To use the facades with an angle system of your own, register its radian with a single specialization keyed on its kind (see the "Working with Polar and Spherical Coordinates" guide):
template<>
constexpr auto mp_units::utility::radian_of<kind_of<my::angle>> = my::radian; // == get_quantity_spec(my::radian)
It is left unspecified for every other kind, which is exactly what detail::AngleUnit rejects - so a non-angle unit is a clean compile error, not a silently wrong conversion.