change const order

move in,ft,fathom,ft2,ft3,mph from us to international namespace
TODO distinguish units with different names for same values
This commit is contained in:
Andy Little
2020-01-12 21:34:36 +01:00
committed by Mateusz Pusz
parent c93136e81b
commit 024f5a9c83
15 changed files with 109 additions and 58 deletions
+3 -3
View File
@@ -27,9 +27,9 @@
namespace units::iau {
struct light_year : named_scaled_unit<light_year,"ly(iau)",no_prefix,ratio<946073,100000,15>,si::metre> {};
struct parsec : named_scaled_unit<parsec,"pc(iau)",no_prefix,ratio<1542839,500000,16>,si::metre> {};
struct angstrom : named_scaled_unit<angstrom,"angstrom(iau)",no_prefix,ratio<1,1,-10>,si::metre> {};
struct light_year : named_scaled_unit<light_year,"ly",no_prefix,ratio<946073,100000,15>,si::metre> {};
struct parsec : named_scaled_unit<parsec,"pc",no_prefix,ratio<1542839,500000,16>,si::metre> {};
struct angstrom : named_scaled_unit<angstrom,"angstrom",no_prefix,ratio<1,1,-10>,si::metre> {};
inline namespace literals {
@@ -25,7 +25,7 @@
#include <units/physical/si/area.h>
#include <units/physical/international/length.h>
namespace units::us {
namespace units::international {
struct square_foot : deduced_unit<square_foot, si::dim_area, international::foot> {};
@@ -37,4 +37,4 @@ constexpr auto operator"" ft2(long double l) { return si::area<square_foot, long
} // namespace literals
} // namespace units::us
} // namespace units::international
@@ -35,7 +35,6 @@ namespace units::international {
//https://en.wikipedia.org/wiki/International_yard_and_pound
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio<9'144, 1'000,-1>, si::metre> {};
//international foot
//https://en.wikipedia.org/wiki/Foot_(unit)#International_foot
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio<3'048,1'000,-1>, si::metre> {};
@@ -55,10 +54,9 @@ struct mile : named_scaled_unit<mile, "mi", no_prefix, ratio<25'146,15'625,3>, s
//https://en.wikipedia.org/wiki/Mile#Nautical_mile
struct nautical_mile : named_scaled_unit<nautical_mile,"mi(naut)",no_prefix, ratio<463,250,3>,si::metre> {};
#if 0
//TODO thou
//https://en.wikipedia.org/wiki/Thousandth_of_an_inch
struct thou : named_scaled_unit<thou,"thou",no_prefix,ratio<127,50,-5>,si::metre> {};
#endif
//struct thou : named_scaled_unit<thou,"thou",no_prefix,ratio<127,50,-5>,si::metre> {};
// different name for thou
//https://en.wikipedia.org/wiki/Thousandth_of_an_inch
struct mil : named_scaled_unit<mil,"mil",no_prefix,ratio<127,50,-5>,si::metre> {};
@@ -89,11 +87,10 @@ constexpr auto operator"" mi(long double l) { return si::length<mile, long doubl
constexpr auto operator"" naut_mi(unsigned long long l) { return si::length<nautical_mile, std::int64_t>(l); }
constexpr auto operator"" naut_mi(long double l) { return si::length<nautical_mile, long double>(l); }
#if 0
// thou
constexpr auto operator"" thou(unsigned long long l) { return si::length<thou, std::int64_t>(l); }
constexpr auto operator"" thou(long double l) { return si::length<thou, long double>(l); }
#endif
//TODO thou
//constexpr auto operator"" thou(unsigned long long l) { return si::length<thou, std::int64_t>(l); }
//constexpr auto operator"" thou(long double l) { return si::length<thou, long double>(l); }
// mil
constexpr auto operator"" mil(unsigned long long l) { return si::length<mil, std::int64_t>(l); }
constexpr auto operator"" mil(long double l) { return si::length<mil, long double>(l); }
@@ -25,7 +25,7 @@
#include <units/physical/si/velocity.h>
#include <units/physical/international/length.h>
namespace units::us {
namespace units::international {
struct mile_per_hour : deduced_unit<mile_per_hour, si::dim_velocity, international::mile, si::hour> {};
@@ -37,4 +37,4 @@ constexpr auto operator"" mph(long double l) { return si::velocity<mile_per_hour
} // namespace literals
} // namespace units::us
} // namespace units::international
@@ -25,7 +25,7 @@
#include <units/physical/si/volume.h>
#include <units/physical/international/length.h>
namespace units::us {
namespace units::international {
struct cubic_foot : deduced_unit<cubic_foot, si::dim_volume, international::foot> {};
@@ -37,4 +37,4 @@ constexpr auto operator""ft3(long double l) { return si::volume<cubic_foot, long
} // namespace literals
} // namespace units::us
} // namespace units::international
+2 -2
View File
@@ -30,7 +30,7 @@
namespace units::si {
struct ohm : named_unit<ohm, "R", prefix> {};
struct ohm : named_unit<ohm, "Ω", prefix> {};
struct milliohm : prefixed_unit<milliohm, milli, ohm> {};
struct kiloohm : prefixed_unit<kiloohm, kilo, ohm> {};
struct megaohm : prefixed_unit<megaohm, mega, ohm> {};
@@ -43,7 +43,7 @@ using resistance = quantity<dim_resistance, U, Rep>;
inline namespace literals {
//R
constexpr auto operator""R(unsigned long long l) { return resistance<ohm, std::int64_t>(l); }
constexpr auto operator""_R(unsigned long long l) { return resistance<ohm, std::int64_t>(l); }
constexpr auto operator""_R(long double l) { return resistance<ohm, long double>(l); }
//mR
+2 -3
View File
@@ -26,7 +26,6 @@
namespace units::us {
#if 1
//https://en.wikipedia.org/wiki/Foot_(unit)#US_survey_foot
//https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
//struct foot : named_scaled_unit<foot,"ft(us)",no_prefix,ratio<3'048,1'000,-1>, si::metre> {};
@@ -39,7 +38,7 @@ struct fathom : named_scaled_unit<fathom,"fathom(us)",no_prefix,ratio<6,1>,us::f
//https://en.wikipedia.org/wiki/Mile#U.S._survey_mile
//https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
struct mile : named_scaled_unit<mile,"mile(us)",no_prefix,ratio<5280,1000,3>,us::foot> {};
struct mile : named_scaled_unit<mile,"mi(us)",no_prefix,ratio<5280,1000,3>,us::foot> {};
inline namespace literals {
@@ -56,5 +55,5 @@ constexpr auto operator"" mi_us(unsigned long long l) { return si::length<units:
constexpr auto operator"" mi_us(long double l) { return si::length<units::us::mile, long double>(l); }
} // namespace literals
#endif
} // namespace units::us