template<typename U>
using IsSimple = std::enable_if_t<std::is_fundamental<U>::value, U>;
template<typename U, class = typename U::type, class = decltype(U::Convert), class = decltype(&U::Get)>
using IsUnit = U;
template<typename U, class = decltype(&U::count)>
using IsDuration = U;
template<typename U, class = IsSimple<U>>
auto ConvertValue(float value) {
return static_cast<U>(value);
}
template<typename U, class = IsUnit<U>, int = 1>
U ConvertValue(float value) {
return U::Convert(value);
}
template<typename U, class = IsSimple<U>>
U GetValue(U value) {
return value;
}
template<typename U, class = IsDuration<U>, int = 1>
auto GetValue(U value) {
return value.count();
}
template<typename U, class = IsUnit<U>, int = 1, int = 1>
auto GetValue(U value) {
return value.Get();
}