Added a few more derived dimensions

This commit is contained in:
Mateusz Pusz
2019-07-24 16:55:21 +02:00
parent 22e0089c77
commit ce53df71fc
11 changed files with 511 additions and 3 deletions

View File

@ -547,5 +547,7 @@ Additionally, it should make the error logs even shorter thus easier to understa
14. Do we need to support fractional exponents (i.e. `dimension<exp<"length", 2, 3>>` as 2/3)?
15. `k` and `K` UDLs conflict with gcc GNU extensions (https://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Fixed_002dPoint.html)
15. `k`, `K`, `W`, `F` UDLs conflict with gcc GNU extensions (https://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Fixed_002dPoint.html)
for floating point types.
16. `J` imaginary constants are a GCC extension

View File

@ -0,0 +1,46 @@
// 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 <units/velocity.h>
namespace std::experimental::units {
struct dimension_acceleration : make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -2>> {};
template<> struct downcasting_traits<downcast_from<dimension_acceleration>> : downcast_to<dimension_acceleration> {};
template<typename T>
concept bool Acceleration = Quantity<T> && std::Same<typename T::dimension, dimension_acceleration>;
struct meter_per_second_sq : derived_unit<dimension_acceleration, meter, second> {};
template<> struct downcasting_traits<downcast_from<meter_per_second_sq>> : downcast_to<meter_per_second_sq> {};
inline namespace literals {
// mps_sq
constexpr auto operator""mps_sq(unsigned long long l) { return quantity<meter_per_second_sq, std::int64_t>(l); }
constexpr auto operator""mps_sq(long double l) { return quantity<meter_per_second_sq, long double>(l); }
} // namespace literals
} // namespace std::experimental::units

View File

@ -0,0 +1,48 @@
// 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 <units/base_dimensions.h>
#include <units/electric_charge.h>
#include <units/voltage.h>
namespace std::experimental::units {
struct dimension_capacitance : make_dimension_t<exp<base_dim_mass, -1>, exp<base_dim_length, -2>, exp<base_dim_time, 4>, exp<base_dim_current, 2>> {};
template<> struct downcasting_traits<downcast_from<dimension_capacitance>> : downcast_to<dimension_capacitance> {};
template<typename T>
concept bool Capacitance = Quantity<T> && std::Same<typename T::dimension, dimension_capacitance>;
struct farad : derived_unit<dimension_capacitance, kilogram, meter, second, ampere> {};
template<> struct downcasting_traits<downcast_from<farad>> : downcast_to<farad> {};
inline namespace literals {
// F
constexpr auto operator""F(unsigned long long l) { return quantity<farad, std::int64_t>(l); }
constexpr auto operator""_F(long double l) { return quantity<farad, long double>(l); }
} // namespace literals
} // namespace std::experimental::units

View File

@ -0,0 +1,48 @@
// 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 <units/base_dimensions.h>
#include <units/time.h>
#include <units/current.h>
namespace std::experimental::units {
struct dimension_electric_charge : make_dimension_t<exp<base_dim_time, 1>, exp<base_dim_current, 1>> {};
template<> struct downcasting_traits<downcast_from<dimension_electric_charge>> : downcast_to<dimension_electric_charge> {};
template<typename T>
concept bool ElectricCharge = Quantity<T> && std::Same<typename T::dimension, dimension_electric_charge>;
struct coulomb : derived_unit<dimension_electric_charge, second, ampere> {};
template<> struct downcasting_traits<downcast_from<coulomb>> : downcast_to<coulomb> {};
inline namespace literals {
// C
constexpr auto operator""C(unsigned long long l) { return quantity<coulomb, std::int64_t>(l); }
constexpr auto operator""C(long double l) { return quantity<coulomb, long double>(l); }
} // namespace literals
} // namespace std::experimental::units

View File

@ -0,0 +1,48 @@
// 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 <units/base_dimensions.h>
#include <units/force.h>
#include <units/pressure.h>
namespace std::experimental::units {
struct dimension_energy : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 2>, exp<base_dim_time, -2>> {};
template<> struct downcasting_traits<downcast_from<dimension_energy>> : downcast_to<dimension_energy> {};
template<typename T>
concept bool Energy = Quantity<T> && std::Same<typename T::dimension, dimension_energy>;
struct joule : derived_unit<dimension_energy, kilogram, meter, second> {};
template<> struct downcasting_traits<downcast_from<joule>> : downcast_to<joule> {};
inline namespace literals {
// J
constexpr auto operator""_J(unsigned long long l) { return quantity<joule, std::int64_t>(l); }
constexpr auto operator""_J(long double l) { return quantity<joule, long double>(l); }
} // namespace literals
} // namespace std::experimental::units

49
src/include/units/force.h Normal file
View File

@ -0,0 +1,49 @@
// 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 <units/base_dimensions.h>
#include <units/mass.h>
#include <units/length.h>
#include <units/time.h>
namespace std::experimental::units {
struct dimension_force : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 1>, exp<base_dim_time, -2>> {};
template<> struct downcasting_traits<downcast_from<dimension_force>> : downcast_to<dimension_force> {};
template<typename T>
concept bool Force = Quantity<T> && std::Same<typename T::dimension, dimension_force>;
struct newton : derived_unit<dimension_force, kilogram, meter, second> {};
template<> struct downcasting_traits<downcast_from<newton>> : downcast_to<newton> {};
inline namespace literals {
// N
constexpr auto operator""N(unsigned long long l) { return quantity<newton, std::int64_t>(l); }
constexpr auto operator""N(long double l) { return quantity<newton, long double>(l); }
} // namespace literals
} // namespace std::experimental::units

47
src/include/units/power.h Normal file
View File

@ -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 <units/base_dimensions.h>
#include <units/energy.h>
namespace std::experimental::units {
struct dimension_power : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 2>, exp<base_dim_time, -3>> {};
template<> struct downcasting_traits<downcast_from<dimension_power>> : downcast_to<dimension_power> {};
template<typename T>
concept bool Power = Quantity<T> && std::Same<typename T::dimension, dimension_power>;
struct watt : derived_unit<dimension_power, kilogram, meter, second> {};
template<> struct downcasting_traits<downcast_from<watt>> : downcast_to<watt> {};
inline namespace literals {
// W
constexpr auto operator""W(unsigned long long l) { return quantity<watt, std::int64_t>(l); }
constexpr auto operator""_W(long double l) { return quantity<watt, long double>(l); }
} // namespace literals
} // namespace std::experimental::units

View File

@ -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 <units/base_dimensions.h>
#include <units/force.h>
namespace std::experimental::units {
struct dimension_pressure : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, -1>, exp<base_dim_time, -2>> {};
template<> struct downcasting_traits<downcast_from<dimension_pressure>> : downcast_to<dimension_pressure> {};
template<typename T>
concept bool Pressure = Quantity<T> && std::Same<typename T::dimension, dimension_pressure>;
struct pascal : derived_unit<dimension_pressure, kilogram, meter, second> {};
template<> struct downcasting_traits<downcast_from<pascal>> : downcast_to<pascal> {};
inline namespace literals {
// Pa
constexpr auto operator""Pa(unsigned long long l) { return quantity<pascal, std::int64_t>(l); }
constexpr auto operator""Pa(long double l) { return quantity<pascal, long double>(l); }
} // namespace literals
} // namespace std::experimental::units

View File

@ -0,0 +1,50 @@
// 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 <units/base_dimensions.h>
#include <units/power.h>
#include <units/current.h>
#include <units/energy.h>
#include <units/electric_charge.h>
namespace std::experimental::units {
struct dimension_voltage : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 2>, exp<base_dim_time, -3>, exp<base_dim_current, -1>> {};
template<> struct downcasting_traits<downcast_from<dimension_voltage>> : downcast_to<dimension_voltage> {};
template<typename T>
concept bool Voltage = Quantity<T> && std::Same<typename T::dimension, dimension_voltage>;
struct volt : derived_unit<dimension_voltage, kilogram, meter, second, ampere> {};
template<> struct downcasting_traits<downcast_from<volt>> : downcast_to<volt> {};
inline namespace literals {
// V
constexpr auto operator""V(unsigned long long l) { return quantity<volt, std::int64_t>(l); }
constexpr auto operator""V(long double l) { return quantity<volt, long double>(l); }
} // namespace literals
} // namespace std::experimental::units

View File

@ -0,0 +1,70 @@
// 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 <units/length.h>
namespace std::experimental::units {
struct dimension_volume : make_dimension_t<exp<base_dim_length, 3>> {};
template<> struct downcasting_traits<downcast_from<dimension_volume>> : downcast_to<dimension_volume> {};
template<typename T>
concept bool Volume = Quantity<T> && std::Same<typename T::dimension, dimension_volume>;
struct cubic_millimeter : derived_unit<dimension_volume, millimeter> {};
template<> struct downcasting_traits<downcast_from<cubic_millimeter>> : downcast_to<cubic_millimeter> {};
struct cubic_centimeter : derived_unit<dimension_volume, centimeter> {};
template<> struct downcasting_traits<downcast_from<cubic_centimeter>> : downcast_to<cubic_centimeter> {};
struct cubic_meter : derived_unit<dimension_volume, meter> {};
template<> struct downcasting_traits<downcast_from<cubic_meter>> : downcast_to<cubic_meter> {};
struct cubic_kilometer : derived_unit<dimension_volume, kilometer, meter> {};
template<> struct downcasting_traits<downcast_from<cubic_kilometer>> : downcast_to<cubic_kilometer> {};
struct cubic_foot : derived_unit<dimension_volume, foot> {};
template<> struct downcasting_traits<downcast_from<cubic_foot>> : downcast_to<cubic_foot> {};
inline namespace literals {
// cub_mm
constexpr auto operator""cub_mm(unsigned long long l) { return quantity<cubic_millimeter, std::int64_t>(l); }
constexpr auto operator""cub_mm(long double l) { return quantity<cubic_millimeter, long double>(l); }
// cub_cm
constexpr auto operator""cub_cm(unsigned long long l) { return quantity<cubic_centimeter, std::int64_t>(l); }
constexpr auto operator""cub_cm(long double l) { return quantity<cubic_centimeter, long double>(l); }
// cub_m
constexpr auto operator""cub_m(unsigned long long l) { return quantity<cubic_meter, std::int64_t>(l); }
constexpr auto operator""cub_m(long double l) { return quantity<cubic_meter, long double>(l); }
// cub_km
constexpr auto operator""cub_km(unsigned long long l) { return quantity<cubic_kilometer, std::int64_t>(l); }
constexpr auto operator""cub_km(long double l) { return quantity<cubic_kilometer, long double>(l); }
} // namespace literals
} // namespace std::experimental::units

View File

@ -24,14 +24,23 @@
#include <units/length.h>
#include <units/mass.h>
#include <units/current.h>
#include <units/current.h>
#include <units/temperature.h>
#include <units/substance.h>
#include <units/luminous_intensity.h>
#include <units/frequency.h>
#include <units/force.h>
#include <units/pressure.h>
#include <units/energy.h>
#include <units/power.h>
#include <units/electric_charge.h>
#include <units/voltage.h>
#include <units/capacitance.h>
#include <units/velocity.h>
#include <units/acceleration.h>
#include <units/area.h>
#include <units/volume.h>
#include <utility>
@ -63,7 +72,7 @@ namespace {
/* ************** DERIVED DIMENSIONS **************** */
/* ************** DERIVED DIMENSIONS WITH NAMED UNITS **************** */
// frequency
@ -73,6 +82,39 @@ namespace {
static_assert(3.2GHz == 3'200'000'000Hz);
// static_assert(10hz * 1min == 600);
// force
static_assert(10kg * 10mps_sq == 100N);
// pressure
static_assert(10N / 10sq_m == 1Pa);
// energy
static_assert(10N * 10m == 100_J);
static_assert(10Pa * 10cub_m == 100_J);
// power
static_assert(10_J / 10s == 1W);
// electric charge
static_assert(10A * 10s == 100C);
// voltage
static_assert(10W / 10A == 1V);
static_assert(10_J / 10C == 1V);
// capacitance
static_assert(10C / 10V == 1F);
/* ************** DERIVED DIMENSIONS IN TERMS OF BASE UNITS **************** */
// velocity
static_assert(std::is_same_v<decltype(1km / 1s), quantity<unit<dimension_velocity, ratio<1000, 1>>, std::int64_t>>);
@ -95,10 +137,21 @@ namespace {
// static_assert(2000m / 2kmph == 1h); // should not compile
static_assert(quantity_cast<quantity<kilometer, int>>(2000m) / 2kmph == 1h);
// acceleration
static_assert(10mps / 10s == 1mps_sq);
// area
static_assert(1m * 1m == 1sq_m);
static_assert(10km * 10km == 100sq_km);
static_assert(1sq_m == 10'000sq_cm);
// volume
static_assert(1m * 1m * 1m == 1cub_m);
static_assert(10sq_m * 10m == 100cub_m);
static_assert(10km * 10km * 10km == 1000cub_km);
static_assert(1cub_m == 1'000'000cub_cm);
} // namespace