mp_units::unit_for

Public helper that yields the unit associated with a quantity-like type.

Synopsis

Declared in <mp-units/framework/quantity_traits.h>
template<typename T>
constexpr auto unit_for = detail::unit_for_impl<T>::value;

Description

Derived from the type's own ::unit member (for quantity / quantity_point) or from quantity_like_traits<T> / quantity_point_like_traits<T> for external types.

This is not a customization point. Users teach the library about external types by specializing quantity_like_traits / quantity_point_like_traits, not this helper.

Template Parameters

Name Description
T a quantity-like or quantity-point-like type