xo-unit: minor: code layout in dim_util.hpp
This commit is contained in:
parent
16b14f6827
commit
33895cf225
1 changed files with 7 additions and 9 deletions
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//#include "stringliteral.hpp"
|
|
||||||
//#include "xo/flatstring/flatstring.hpp"
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
|
|
@ -35,11 +33,11 @@ namespace xo {
|
||||||
dim2str(dim x)
|
dim2str(dim x)
|
||||||
{
|
{
|
||||||
switch(x) {
|
switch(x) {
|
||||||
case dim::mass: return "mass";
|
case dim::mass: return "mass";
|
||||||
case dim::distance: return "distance";
|
case dim::distance: return "distance";
|
||||||
case dim::time: return "time";
|
case dim::time: return "time";
|
||||||
case dim::currency: return "currency";
|
case dim::currency: return "currency";
|
||||||
case dim::price: return "price";
|
case dim::price: return "price";
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return "?dim";
|
return "?dim";
|
||||||
|
|
@ -59,19 +57,19 @@ namespace xo {
|
||||||
struct native_unit_for;
|
struct native_unit_for;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct native_unit_for<dim::mass> { static constexpr auto value = native_unit_id::gram; };
|
struct native_unit_for<dim::mass> { static constexpr auto value = native_unit_id::gram; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct native_unit_for<dim::distance> { static constexpr auto value = native_unit_id::meter; };
|
struct native_unit_for<dim::distance> { static constexpr auto value = native_unit_id::meter; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct native_unit_for<dim::time> { static constexpr auto value = native_unit_id::second; };
|
struct native_unit_for<dim::time> { static constexpr auto value = native_unit_id::second; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct native_unit_for<dim::currency> { static constexpr auto value = native_unit_id::currency; };
|
struct native_unit_for<dim::currency> { static constexpr auto value = native_unit_id::currency; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct native_unit_for<dim::price> { static constexpr auto value = native_unit_id::price; };
|
struct native_unit_for<dim::price> { static constexpr auto value = native_unit_id::price; };
|
||||||
|
|
||||||
template <dim Dim>
|
template <dim Dim>
|
||||||
constexpr auto native_unit_for_v = native_unit_for<Dim>::value;
|
constexpr auto native_unit_for_v = native_unit_for<Dim>::value;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue