From 283e9d81a317351cc16a13cbe4a13eabe979fbd8 Mon Sep 17 00:00:00 2001 From: Andy Little Date: Fri, 10 Jan 2020 02:03:27 +0000 Subject: [PATCH] Split the various non-si length units into their own namespaces. new namespaces are international ( combination of us and imperial + Canada etc) iau (https://www.iau.org/ imperial ( old imperial units) typographical ( for sizes of printing fonts etc) These namespace are based on some research , mainly on wikipedia. Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change. Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version The main change in the layout is that inch,foot and yard have been moved from us to international. With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units. This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch. --- example/avg_velocity.cpp | 4 +- example/clcpp_response.cpp | 66 ++++++----- example/hello_units.cpp | 2 +- src/include/units/physical/iau/length.h | 47 ++++++++ src/include/units/physical/imperial/length.h | 43 ++++++++ .../units/physical/international/length.h | 103 ++++++++++++++++++ src/include/units/physical/si/length.h | 91 +--------------- .../units/physical/typographic/length.h | 55 ++++++++++ src/include/units/physical/us/area.h | 4 +- src/include/units/physical/us/length.h | 42 ++++--- src/include/units/physical/us/velocity.h | 4 +- src/include/units/physical/us/volume.h | 4 +- test/unit_test/static/us_test.cpp | 2 + 13 files changed, 325 insertions(+), 142 deletions(-) create mode 100644 src/include/units/physical/iau/length.h create mode 100644 src/include/units/physical/imperial/length.h create mode 100644 src/include/units/physical/international/length.h create mode 100644 src/include/units/physical/typographic/length.h diff --git a/example/avg_velocity.cpp b/example/avg_velocity.cpp index 5c1bfae5..1127e9a3 100644 --- a/example/avg_velocity.cpp +++ b/example/avg_velocity.cpp @@ -97,7 +97,7 @@ void example() // Customary Units (int) { - using namespace units::us::literals; + using namespace units::international::literals; constexpr Length AUTO distance = 140mi; // constructed from a UDL constexpr si::time duration(2); // constructed from a value @@ -113,7 +113,7 @@ void example() // Customary Units (double) { - using namespace units::us::literals; + using namespace units::international::literals; constexpr Length AUTO distance = 140.mi; // constructed from a UDL constexpr si::time duration(2); // constructed from a value diff --git a/example/clcpp_response.cpp b/example/clcpp_response.cpp index 8ffff7d4..857d4495 100644 --- a/example/clcpp_response.cpp +++ b/example/clcpp_response.cpp @@ -17,7 +17,11 @@ */ #include +#include #include +#include +#include +#include #include #include #include @@ -41,55 +45,55 @@ namespace { using AU = units::si::length; template - using in = units::si::length; + using in = units::si::length; template - using angstrom = units::si::length; + using angstrom = units::si::length; template - using ch = units::si::length; + using ch = units::si::length; template - using fathom = units::si::length; + using fathom = units::si::length; +#if 1 + template + using fathom_us = units::si::length; +#endif + template + using ft = units::si::length; +#if 1 + template + using ft_us = units::si::length; +#endif + template + using ly = units::si::length; template - using fathom_us = units::si::length; + using mi = units::si::length; template - using ft = units::si::length; + using mi_naut = units::si::length; template - using ft_us = units::si::length; + using pc = units::si::length; template - using ly = units::si::length; + using pica_comp = units::si::length; template - using mi = units::si::length; + using pica_prn = units::si::length; template - using mi_naut = units::si::length; + using point_comp = units::si::length; template - using pc = units::si::length; + using point_prn = units::si::length; template - using pica_comp = units::si::length; + using rd = units::si::length; template - using pica_prn = units::si::length; - - template - using point_comp = units::si::length; - - template - using point_prn = units::si::length; - - template - using rd = units::si::length; - - template - using yd = units::si::length; + using yd = units::si::length; } @@ -118,13 +122,15 @@ namespace { #include using namespace units::si::literals; +//using namespace units::si; +using namespace units::international; void simple_quantities() { using distance = length::m<>; using time = time::s<>; distance constexpr km = 1.0km; - distance constexpr miles = 1q_mi; + distance constexpr miles = 1.0mi; time constexpr sec = 1s; time constexpr min = 1min; @@ -143,7 +149,7 @@ void quantities_with_typed_units() { length::km<> constexpr km = 1km; - length::mi<> constexpr miles = 1q_mi; + length::mi<> constexpr miles = 1.0mi; std::cout.precision(6); @@ -168,9 +174,13 @@ void quantities_with_typed_units() std::cout << " = " << length::angstrom<>(meter) << '\n'; std::cout << " = " << length::ch<>(meter) << '\n'; std::cout << " = " << length::fathom<>(meter) << '\n'; +#if 1 std::cout << " = " << length::fathom_us<>(meter) << '\n'; +#endif std::cout << " = " << length::ft<>(meter) << '\n'; - std::cout << " = " << length::ft_us<>(meter) << '\n'; +#if 1 + std::cout << " = " << length::ft_us<>(meter) << '\n'; +#endif std::cout << " = " << length::in<>(meter) << '\n'; std::cout << " = " << length::ly<>(meter) << '\n'; std::cout << " = " << length::mi<>(meter) << '\n'; diff --git a/example/hello_units.cpp b/example/hello_units.cpp index 3ca1dde8..c90a6b8b 100644 --- a/example/hello_units.cpp +++ b/example/hello_units.cpp @@ -36,7 +36,7 @@ int main() { using namespace si::literals; Velocity AUTO v1 = avg_speed(220km, 2h); - Velocity AUTO v2 = avg_speed(si::length(140), si::time(2)); + Velocity AUTO v2 = avg_speed(si::length(140), si::time(2)); Velocity AUTO v3 = quantity_cast(v2); Velocity AUTO v4 = quantity_cast(v3); diff --git a/src/include/units/physical/iau/length.h b/src/include/units/physical/iau/length.h new file mode 100644 index 00000000..bdf7986d --- /dev/null +++ b/src/include/units/physical/iau/length.h @@ -0,0 +1,47 @@ + +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::iau { + +struct light_year : named_scaled_unit,si::metre> {}; +struct parsec : named_scaled_unit,si::metre> {}; +struct angstrom : named_scaled_unit,si::metre> {}; + +inline namespace literals { + +constexpr auto operator"" ly(unsigned long long l) { return si::length(l); } +constexpr auto operator"" ly(long double l) { return si::length(l); } + +constexpr auto operator"" pc(unsigned long long l) { return si::length(l); } +constexpr auto operator"" pc(long double l) { return si::length(l); } + +constexpr auto operator"" angstrom(unsigned long long l) { return si::length(l); } +constexpr auto operator"" angstrom(long double l) { return si::length(l); } + +} // namespace literals + +} // namespace units::iau diff --git a/src/include/units/physical/imperial/length.h b/src/include/units/physical/imperial/length.h new file mode 100644 index 00000000..4ece6b44 --- /dev/null +++ b/src/include/units/physical/imperial/length.h @@ -0,0 +1,43 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::imperial { + +struct chain : named_scaled_unit, si::metre> {}; +struct rod : named_scaled_unit,si::metre> {}; + +inline namespace literals { + +constexpr auto operator"" ch(unsigned long long l) { return si::length(l); } +constexpr auto operator"" ch(long double l) { return si::length(l); } + +constexpr auto operator"" rd(unsigned long long l) { return si::length(l); } +constexpr auto operator"" rd(long double l) { return si::length(l); } + + +} // namespace literals + +} // namespace units::si diff --git a/src/include/units/physical/international/length.h b/src/include/units/physical/international/length.h new file mode 100644 index 00000000..8ff84d45 --- /dev/null +++ b/src/include/units/physical/international/length.h @@ -0,0 +1,103 @@ + +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +/* + international units of length are defined in terms of the si metre +*/ + +namespace units::international { + +//international yard +//https://en.wikipedia.org/wiki/International_yard_and_pound +struct yard : named_scaled_unit, si::metre> {}; + + +//international foot +//https://en.wikipedia.org/wiki/Foot_(unit)#International_foot +struct foot : named_scaled_unit, si::metre> {}; + +//https://en.wikipedia.org/wiki/Fathom#International_fathom +struct fathom : named_scaled_unit,si::metre > {}; + +//international inch +//https://en.wikipedia.org/wiki/Inch#Equivalences +struct inch : named_scaled_unit, si::metre> {}; + +//intrnational mile +//https://en.wikipedia.org/wiki/Mile#International_mile +struct mile : named_scaled_unit, si::metre> {}; + +//international nautical mile +//https://en.wikipedia.org/wiki/Mile#Nautical_mile +struct nautical_mile : named_scaled_unit,si::metre> {}; + +#if 0 +//https://en.wikipedia.org/wiki/Thousandth_of_an_inch +struct thou : named_scaled_unit,si::metre> {}; +#endif +// different name for thou +//https://en.wikipedia.org/wiki/Thousandth_of_an_inch +struct mil : named_scaled_unit,si::metre> {}; + +inline namespace literals { + +// yd +constexpr auto operator"" yd(unsigned long long l) { return si::length(l); } +constexpr auto operator"" yd(long double l) { return si::length(l); } + +// ft +constexpr auto operator"" ft(unsigned long long l) { return si::length(l); } +constexpr auto operator"" ft(long double l) { return si::length(l); } + +// fathom +constexpr auto operator"" fathom(unsigned long long l) { return si::length(l); } +constexpr auto operator"" fathom(long double l) { return si::length(l); } + +// in +constexpr auto operator"" in(unsigned long long l) { return si::length(l); } +constexpr auto operator"" in(long double l) { return si::length(l); } + +// mi +constexpr auto operator"" mi(unsigned long long l) { return si::length(l); } +constexpr auto operator"" mi(long double l) { return si::length(l); } + +// mi_naut +constexpr auto operator"" naut_mi(unsigned long long l) { return si::length(l); } +constexpr auto operator"" naut_mi(long double l) { return si::length(l); } + +#if 0 +// thou +constexpr auto operator"" thou(unsigned long long l) { return si::length(l); } +constexpr auto operator"" thou(long double l) { return si::length(l); } +#endif +// mil +constexpr auto operator"" mil(unsigned long long l) { return si::length(l); } +constexpr auto operator"" mil(long double l) { return si::length(l); } + +} // namespace literals + +} //namespace units::international \ No newline at end of file diff --git a/src/include/units/physical/si/length.h b/src/include/units/physical/si/length.h index 46ef1646..53c225f1 100644 --- a/src/include/units/physical/si/length.h +++ b/src/include/units/physical/si/length.h @@ -37,31 +37,6 @@ struct kilometre : prefixed_unit {}; struct femtometre : prefixed_unit {}; struct astronomical_unit : named_scaled_unit, metre> {}; -#if 0 -struct inch : named_scaled_unit, metre> {}; -struct foot : named_scaled_unit, metre> {}; -struct yard : named_scaled_unit, metre> {}; -#endif -struct foot_us : named_scaled_unit, metre> {}; -struct fathom : named_scaled_unit, metre> {}; -struct fathom_us : named_scaled_unit,metre> {}; -struct chain : named_scaled_unit, metre> {}; - -#if 0 -struct thou : named_scaled_unit,metre> {}; -#endif -struct mil : named_scaled_unit,metre> {}; - -struct light_year : named_scaled_unit,metre> {}; -struct mile : named_scaled_unit,metre> {}; -struct nautical_mile : named_scaled_unit,metre> {}; -struct parsec : named_scaled_unit,metre> {}; -struct pica_comp : named_scaled_unit,metre> {}; -struct pica_prn : named_scaled_unit,metre> {}; -struct point_comp : named_scaled_unit,metre> {}; -struct point_prn : named_scaled_unit,metre> {}; -struct rod : named_scaled_unit,metre> {}; -struct angstrom : named_scaled_unit,metre> {}; struct dim_length : physical::dim_length {}; @@ -74,14 +49,14 @@ inline namespace literals { constexpr auto operator"" m(unsigned long long l) { return length(l); } constexpr auto operator"" m(long double l) { return length(l); } -// mm -constexpr auto operator"" mm(unsigned long long l) { return length(l); } -constexpr auto operator"" mm(long double l) { return length(l); } - // fm constexpr auto operator"" fm(unsigned long long l) { return length(l); } constexpr auto operator"" fm(long double l) { return length(l); } +// mm +constexpr auto operator"" mm(unsigned long long l) { return length(l); } +constexpr auto operator"" mm(long double l) { return length(l); } + // cm constexpr auto operator"" cm(unsigned long long l) { return length(l); } constexpr auto operator"" cm(long double l) { return length(l); } @@ -101,64 +76,6 @@ constexpr auto operator"" km(long double l) { return length(l); } constexpr auto operator"" au(long double l) { return length(l); } -#if 0 -constexpr auto operator"" q_in(unsigned long long l) { return length(l); } -constexpr auto operator"" q_in(long double l) { return length(l); } - -constexpr auto operator"" q_ft(unsigned long long l) { return length(l); } -constexpr auto operator"" q_ft(long double l) { return length(l); } - -constexpr auto operator"" q_yd(unsigned long long l) { return length(l); } -constexpr auto operator"" q_yd(long double l) { return length(l); } -#endif -constexpr auto operator"" ft_us(unsigned long long l) { return length(l); } -constexpr auto operator"" ft_us(long double l) { return length(l); } - -constexpr auto operator"" fathom(unsigned long long l) { return length(l); } -constexpr auto operator"" fathom(long double l) { return length(l); } - -constexpr auto operator"" fathom_us(unsigned long long l) { return length(l); } -constexpr auto operator"" fathom_us(long double l) { return length(l); } - -constexpr auto operator"" ch(unsigned long long l) { return length(l); } -constexpr auto operator"" ch(long double l) { return length(l); } - -#if 0 -constexpr auto operator"" thou(unsigned long long l) { return length(l); } -constexpr auto operator"" thou(long double l) { return length(l); } -#endif -constexpr auto operator"" mil(unsigned long long l) { return length(l); } -constexpr auto operator"" mil(long double l) { return length(l); } - -constexpr auto operator"" ly(unsigned long long l) { return length(l); } -constexpr auto operator"" ly(long double l) { return length(l); } - -constexpr auto operator"" q_mi(unsigned long long l) { return length(l); } -constexpr auto operator"" q_mi(long double l) { return length(l); } - -constexpr auto operator"" pc(unsigned long long l) { return length(l); } -constexpr auto operator"" pc(long double l) { return length(l); } - -constexpr auto operator"" mi_naut(unsigned long long l) { return length(l); } -constexpr auto operator"" mi_naut(long double l) { return length(l); } - -constexpr auto operator"" pica_comp(unsigned long long l) { return length(l); } -constexpr auto operator"" pica_comp(long double l) { return length(l); } - -constexpr auto operator"" pica_prn(unsigned long long l) { return length(l); } -constexpr auto operator"" pica_prn(long double l) { return length(l); } - -constexpr auto operator"" point_comp(unsigned long long l) { return length(l); } -constexpr auto operator"" point_comp(long double l) { return length(l); } - -constexpr auto operator"" point_prn(unsigned long long l) { return length(l); } -constexpr auto operator"" point_prn(long double l) { return length(l); } - -constexpr auto operator"" rd(unsigned long long l) { return length(l); } -constexpr auto operator"" rd(long double l) { return length(l); } - -constexpr auto operator"" angstrom(unsigned long long l) { return length(l); } -constexpr auto operator"" angstrom(long double l) { return length(l); } } // namespace literals diff --git a/src/include/units/physical/typographic/length.h b/src/include/units/physical/typographic/length.h new file mode 100644 index 00000000..2b1cfe12 --- /dev/null +++ b/src/include/units/physical/typographic/length.h @@ -0,0 +1,55 @@ + +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::typographic { + +struct pica_comp : named_scaled_unit,si::metre> {}; +struct pica_prn : named_scaled_unit,si::metre> {}; +struct point_comp : named_scaled_unit,si::metre> {}; +struct point_prn : named_scaled_unit,si::metre> {}; + +inline namespace literals { + + // pica comp +constexpr auto operator"" pica_comp(unsigned long long l) { return si::length(l); } +constexpr auto operator"" pica_comp(long double l) { return si::length(l); } + + // pica prn +constexpr auto operator"" pica_prn(unsigned long long l) { return si::length(l); } +constexpr auto operator"" pica_prn(long double l) { return si::length(l); } + + // point comp +constexpr auto operator"" point_comp(unsigned long long l) { return si::length(l); } +constexpr auto operator"" point_comp(long double l) { return si::length(l); } + + // point prn +constexpr auto operator"" point_prn(unsigned long long l) { return si::length(l); } +constexpr auto operator"" point_prn(long double l) { return si::length(l); } + +} // namespace literals + +} // namespace units::typographic diff --git a/src/include/units/physical/us/area.h b/src/include/units/physical/us/area.h index 9dad9d4f..713afcc4 100644 --- a/src/include/units/physical/us/area.h +++ b/src/include/units/physical/us/area.h @@ -23,11 +23,11 @@ #pragma once #include -#include +#include namespace units::us { -struct square_foot : deduced_unit {}; +struct square_foot : deduced_unit {}; inline namespace literals { diff --git a/src/include/units/physical/us/length.h b/src/include/units/physical/us/length.h index c2ac6509..bc4f5782 100644 --- a/src/include/units/physical/us/length.h +++ b/src/include/units/physical/us/length.h @@ -26,29 +26,35 @@ namespace units::us { -struct yard : named_scaled_unit, si::metre> {}; -struct foot : named_scaled_unit, yard> {}; -struct inch : named_scaled_unit, foot> {}; -struct mile : named_scaled_unit, yard> {}; +#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, si::metre> {}; +//################### causes integer overflow when converting for volume ####################### +struct foot : named_scaled_unit, si::metre> {}; +//############################################################################################# + +//https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6 +struct fathom : named_scaled_unit,us::foot> {}; + +//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,us::foot> {}; inline namespace literals { -// yd -constexpr auto operator"" yd(unsigned long long l) { return si::length(l); } -constexpr auto operator"" yd(long double l) { return si::length(l); } +// ft +constexpr auto operator"" ft_us(unsigned long long l) { return si::length(l); } +constexpr auto operator"" ft_us(long double l) { return si::length(l); } + +// fathom +constexpr auto operator"" fathom_us(unsigned long long l) { return si::length(l); } +constexpr auto operator"" fathom_us(long double l) { return si::length(l); } // ft -constexpr auto operator"" ft(unsigned long long l) { return si::length(l); } -constexpr auto operator"" ft(long double l) { return si::length(l); } - -// in -constexpr auto operator"" in(unsigned long long l) { return si::length(l); } -constexpr auto operator"" in(long double l) { return si::length(l); } - -// mi -constexpr auto operator"" mi(unsigned long long l) { return si::length(l); } -constexpr auto operator"" mi(long double l) { return si::length(l); } +constexpr auto operator"" mi_us(unsigned long long l) { return si::length(l); } +constexpr auto operator"" mi_us(long double l) { return si::length(l); } } // namespace literals - +#endif } // namespace units::us diff --git a/src/include/units/physical/us/velocity.h b/src/include/units/physical/us/velocity.h index ac5d686f..b01d3af9 100644 --- a/src/include/units/physical/us/velocity.h +++ b/src/include/units/physical/us/velocity.h @@ -23,11 +23,11 @@ #pragma once #include -#include +#include namespace units::us { -struct mile_per_hour : deduced_unit {}; +struct mile_per_hour : deduced_unit {}; inline namespace literals { diff --git a/src/include/units/physical/us/volume.h b/src/include/units/physical/us/volume.h index c01e51d5..4e315b42 100644 --- a/src/include/units/physical/us/volume.h +++ b/src/include/units/physical/us/volume.h @@ -23,11 +23,11 @@ #pragma once #include -#include +#include namespace units::us { -struct cubic_foot : deduced_unit {}; +struct cubic_foot : deduced_unit {}; inline namespace literals { diff --git a/test/unit_test/static/us_test.cpp b/test/unit_test/static/us_test.cpp index 30bdd9dd..843f0a21 100644 --- a/test/unit_test/static/us_test.cpp +++ b/test/unit_test/static/us_test.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -35,6 +36,7 @@ namespace { using namespace units; using namespace units::si; using namespace units::us; +using namespace units::international; /* ************** BASE DIMENSIONS **************** */