mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 10:27:16 +02:00
feat: quantity_values
are now defined on top of std::chrono::duration_values
This commit is contained in:
@ -115,6 +115,9 @@ constexpr bool is_tensor = false;
|
|||||||
* @tparam Rep a representation type for which a type trait is defined
|
* @tparam Rep a representation type for which a type trait is defined
|
||||||
*/
|
*/
|
||||||
template<typename Rep>
|
template<typename Rep>
|
||||||
|
#if MP_UNITS_HOSTED
|
||||||
|
struct quantity_values : std::chrono::duration_values<Rep> {
|
||||||
|
#else
|
||||||
struct quantity_values {
|
struct quantity_values {
|
||||||
static constexpr Rep zero() noexcept
|
static constexpr Rep zero() noexcept
|
||||||
requires std::constructible_from<Rep, int>
|
requires std::constructible_from<Rep, int>
|
||||||
@ -122,12 +125,6 @@ struct quantity_values {
|
|||||||
return Rep(0);
|
return Rep(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Rep one() noexcept
|
|
||||||
requires std::constructible_from<Rep, int>
|
|
||||||
{
|
|
||||||
return Rep(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static constexpr Rep min() noexcept
|
static constexpr Rep min() noexcept
|
||||||
requires requires {
|
requires requires {
|
||||||
{ std::numeric_limits<Rep>::lowest() } -> std::same_as<Rep>;
|
{ std::numeric_limits<Rep>::lowest() } -> std::same_as<Rep>;
|
||||||
@ -143,6 +140,13 @@ struct quantity_values {
|
|||||||
{
|
{
|
||||||
return std::numeric_limits<Rep>::max();
|
return std::numeric_limits<Rep>::max();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static constexpr Rep one() noexcept
|
||||||
|
requires std::constructible_from<Rep, int>
|
||||||
|
{
|
||||||
|
return Rep(1);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
Reference in New Issue
Block a user