forked from mpusz/mp-units
Merge branch 'master' into chiphogg/switch-to-mag
This commit is contained in:
@@ -189,7 +189,7 @@ TEST_CASE("operator<< on a quantity", "[text][ostream][fmt]")
|
||||
SECTION("surface tension")
|
||||
{
|
||||
struct newton_per_centimetre :
|
||||
derived_unit<newton_per_centimetre, si::dim_surface_tension, newton, centimetre> {};
|
||||
derived_scaled_unit<newton_per_centimetre, si::dim_surface_tension, newton, centimetre> {};
|
||||
const surface_tension<newton_per_centimetre> q(123);
|
||||
os << q;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ TEST_CASE("std::format on synthesized unit symbols", "[text][fmt]")
|
||||
CHECK(STD_FMT::format("{}", 1_q_fathom_us) == "1 fathom(us)");
|
||||
CHECK(STD_FMT::format("{}", 1_q_mi) == "1 mi");
|
||||
CHECK(STD_FMT::format("{}", 1_q_mi_us) == "1 mi(us)");
|
||||
CHECK(STD_FMT::format("{}", 1_q_naut_mi) == "1 mi(naut)");
|
||||
CHECK(STD_FMT::format("{}", 1_q_naut_mi) == "1 nmi");
|
||||
CHECK(STD_FMT::format("{}", 1_q_ch) == "1 ch");
|
||||
CHECK(STD_FMT::format("{}", 1_q_rd) == "1 rd");
|
||||
CHECK(STD_FMT::format("{}", 1_q_thou) == "1 thou");
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "test_tools.h"
|
||||
#include <units/bits/external/type_traits.h>
|
||||
#include <units/chrono.h>
|
||||
#include <units/isq/si/length.h>
|
||||
@@ -82,12 +83,12 @@ static_assert(!std::convertible_to<sys_seconds, time_point<std::chrono::system_c
|
||||
|
||||
|
||||
// CTAD
|
||||
static_assert(is_same_v<decltype(quantity{1s}), si::time<si::second, std::chrono::seconds::rep>>);
|
||||
static_assert(is_same_v<decltype(quantity{1h}), si::time<si::hour, std::chrono::hours::rep>>);
|
||||
static_assert(is_same_v<decltype(quantity_point{sys_seconds{1s}}),
|
||||
time_point<std::chrono::system_clock, si::second, sys_seconds::rep>>);
|
||||
static_assert(is_same_v<decltype(quantity_point{sys_days{sys_days::duration{1}}}),
|
||||
time_point<std::chrono::system_clock, si::day, sys_days::rep>>);
|
||||
static_assert(compare<decltype(quantity{1s}), si::time<si::second, std::chrono::seconds::rep>>);
|
||||
static_assert(compare<decltype(quantity{1h}), si::time<si::hour, std::chrono::hours::rep>>);
|
||||
static_assert(compare<decltype(quantity_point{sys_seconds{1s}}),
|
||||
time_point<std::chrono::system_clock, si::second, sys_seconds::rep>>);
|
||||
static_assert(compare<decltype(quantity_point{sys_days{sys_days::duration{1}}}),
|
||||
time_point<std::chrono::system_clock, si::day, sys_days::rep>>);
|
||||
|
||||
// operators
|
||||
static_assert(quantity{1s} + 1_q_s == 2_q_s);
|
||||
|
||||
@@ -42,15 +42,9 @@ namespace {
|
||||
using namespace units;
|
||||
using namespace units::isq;
|
||||
|
||||
// Prefix family
|
||||
|
||||
static_assert(PrefixFamily<si::prefix>);
|
||||
static_assert(!PrefixFamily<si::kilo>);
|
||||
|
||||
// Prefix
|
||||
|
||||
static_assert(Prefix<si::kilo>);
|
||||
static_assert(!Prefix<si::prefix>);
|
||||
static_assert(!Prefix<std::kilo>);
|
||||
|
||||
// BaseDimension
|
||||
@@ -83,6 +77,13 @@ static_assert(!Unit<si::dim_length>);
|
||||
static_assert(!Unit<int>);
|
||||
static_assert(!Unit<std::chrono::seconds>);
|
||||
|
||||
// NamedUnit
|
||||
|
||||
static_assert(NamedUnit<si::metre>);
|
||||
static_assert(NamedUnit<si::kilometre>);
|
||||
static_assert(NamedUnit<si::fps::mile>);
|
||||
static_assert(!NamedUnit<si::metre_per_second>);
|
||||
|
||||
// UnitOf
|
||||
|
||||
static_assert(UnitOf<si::metre, si::dim_length>);
|
||||
|
||||
@@ -36,7 +36,7 @@ using namespace units;
|
||||
using namespace units::isq::si;
|
||||
|
||||
// power spectral density
|
||||
struct sq_volt_per_hertz : unit<sq_volt_per_hertz> {};
|
||||
struct sq_volt_per_hertz : derived_unit<sq_volt_per_hertz> {};
|
||||
struct dim_power_spectral_density :
|
||||
derived_dimension<dim_power_spectral_density, sq_volt_per_hertz, units::exponent<dim_voltage, 2>,
|
||||
units::exponent<dim_frequency, -1>> {};
|
||||
@@ -45,7 +45,7 @@ template<UnitOf<dim_power_spectral_density> U, Representation Rep = double>
|
||||
using power_spectral_density = quantity<dim_power_spectral_density, U, Rep>;
|
||||
|
||||
// amplitude spectral density
|
||||
struct volt_per_sqrt_hertz : unit<volt_per_sqrt_hertz> {};
|
||||
struct volt_per_sqrt_hertz : derived_unit<volt_per_sqrt_hertz> {};
|
||||
struct dim_amplitude_spectral_density :
|
||||
derived_dimension<dim_amplitude_spectral_density, volt_per_sqrt_hertz, units::exponent<dim_voltage, 1>,
|
||||
units::exponent<dim_frequency, -1, 2>> {};
|
||||
@@ -69,11 +69,11 @@ static_assert(compare<decltype(sqrt(power_spectral_density<sq_volt_per_hertz>(16
|
||||
|
||||
namespace {
|
||||
|
||||
struct kilogram_per_second : unit<kilogram_per_second> {};
|
||||
struct kilogram_per_second : derived_unit<kilogram_per_second> {};
|
||||
struct dim_mass_rate :
|
||||
derived_dimension<dim_mass_rate, kilogram_per_second, units::exponent<dim_mass, 1>, units::exponent<dim_time, -1>> {
|
||||
};
|
||||
struct kilogram_per_hour : derived_unit<kilogram_per_hour, dim_mass_rate, kilogram, hour> {};
|
||||
struct kilogram_per_hour : derived_scaled_unit<kilogram_per_hour, dim_mass_rate, kilogram, hour> {};
|
||||
[[maybe_unused]] constexpr auto a = 1_q_kg / 1_q_h;
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -30,13 +30,13 @@ using namespace units;
|
||||
|
||||
namespace {
|
||||
|
||||
struct u0 : named_unit<u0, "u0", no_prefix> {};
|
||||
struct u0 : named_unit<u0, "u0"> {};
|
||||
struct d0 : base_dimension<"d0", u0> {};
|
||||
struct u1 : named_unit<u1, "u1", no_prefix> {};
|
||||
struct u1 : named_unit<u1, "u1"> {};
|
||||
struct d1 : base_dimension<"d1", u1> {};
|
||||
struct u2 : named_unit<u2, "u2", no_prefix> {};
|
||||
struct u2 : named_unit<u2, "u2"> {};
|
||||
struct d2 : base_dimension<"d2", u2> {};
|
||||
struct u3 : named_unit<u3, "u3", no_prefix> {};
|
||||
struct u3 : named_unit<u3, "u3"> {};
|
||||
struct d3 : base_dimension<"d3", u3> {};
|
||||
|
||||
// exponent_invert
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "test_tools.h"
|
||||
#include <units/bits/equivalent.h>
|
||||
#include <units/bits/external/downcasting.h>
|
||||
#include <units/bits/external/type_traits.h>
|
||||
@@ -62,7 +63,7 @@ static_assert(!PointKind<azimuth::_kind_base>);
|
||||
|
||||
static_assert(is_same_v<radius::base_kind, radius>);
|
||||
static_assert(is_same_v<radius::dimension, dim_length>);
|
||||
static_assert(is_same_v<downcast_result<radius>, downcast_kind<radius, dim_length>>);
|
||||
static_assert(compare<downcast_result<radius>, downcast_kind<radius, dim_length>>);
|
||||
|
||||
static_assert(equivalent<radius, radius>);
|
||||
static_assert(equivalent<radius, radius::kind>);
|
||||
@@ -124,7 +125,7 @@ static_assert(PointKind<abscissa::_point_kind_base>);
|
||||
|
||||
static_assert(is_same_v<abscissa::base_kind, width>);
|
||||
static_assert(is_same_v<abscissa::dimension, dim_length>);
|
||||
static_assert(is_same_v<downcast_result<abscissa>, downcast_point_kind<width>>);
|
||||
static_assert(compare<downcast_result<abscissa>, downcast_point_kind<width>>);
|
||||
|
||||
static_assert(equivalent<abscissa, abscissa>);
|
||||
static_assert(equivalent<abscissa, abscissa::point_kind>);
|
||||
@@ -162,8 +163,8 @@ static_assert(!PointKind<rate_of_climb::_kind_base>);
|
||||
|
||||
static_assert(is_same_v<rate_of_climb::base_kind, height>);
|
||||
static_assert(is_same_v<rate_of_climb::dimension, dim_speed>);
|
||||
static_assert(is_same_v<downcast_result<rate_of_climb>, downcast_kind<rate_of_climb, dim_speed>>);
|
||||
static_assert(is_same_v<downcast_result<rate_of_climb>, downcast_kind<height, dim_speed>>);
|
||||
static_assert(compare<downcast_result<rate_of_climb>, downcast_kind<rate_of_climb, dim_speed>>);
|
||||
static_assert(compare<downcast_result<rate_of_climb>, downcast_kind<height, dim_speed>>);
|
||||
|
||||
static_assert(equivalent<rate_of_climb, rate_of_climb>);
|
||||
static_assert(equivalent<rate_of_climb, rate_of_climb::derived_kind>);
|
||||
@@ -181,7 +182,7 @@ static_assert(PointKind<velocity_of_climb::_point_kind_base>);
|
||||
|
||||
static_assert(is_same_v<velocity_of_climb::base_kind, rate_of_climb>);
|
||||
static_assert(is_same_v<velocity_of_climb::dimension, dim_speed>);
|
||||
static_assert(is_same_v<downcast_result<velocity_of_climb>, downcast_point_kind<rate_of_climb>>);
|
||||
static_assert(compare<downcast_result<velocity_of_climb>, downcast_point_kind<rate_of_climb>>);
|
||||
|
||||
static_assert(equivalent<velocity_of_climb, velocity_of_climb>);
|
||||
static_assert(equivalent<velocity_of_climb, velocity_of_climb::point_kind>);
|
||||
@@ -200,6 +201,6 @@ static_assert(!equivalent<height::_kind_base, velocity_of_climb::_point_kind_bas
|
||||
static_assert(!equivalent<rate_of_climb, velocity_of_climb>);
|
||||
static_assert(!equivalent<rate_of_climb::_kind_base, velocity_of_climb::_point_kind_base>);
|
||||
|
||||
static_assert(is_same_v<downcast_result<height>, downcast_kind<rate_of_climb, dim_length>>);
|
||||
static_assert(compare<downcast_result<height>, downcast_kind<rate_of_climb, dim_length>>);
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -481,11 +481,11 @@ static_assert(invalid_compound_assignments_<time_kind, second, std::chrono::seco
|
||||
static_assert(same(width<metre, int>(2 * m) + width<metre, int>(3 * m), width<metre, int>(5 * m)));
|
||||
static_assert(same(width<metre, int>(2 * m) + width<metre, double>(3. * m), width<metre, double>(5. * m)));
|
||||
static_assert(same(width<metre, double>(2. * m) + width<metre, int>(3 * m), width<metre, double>(5. * m)));
|
||||
static_assert(same(width<kilometre, int>(2 * km) + width<metre, double>(3e3 * m), width<metre, double>(5e3 * m)));
|
||||
static_assert(comp(width<kilometre, int>(2 * km) + width<metre, double>(3e3 * m), width<metre, double>(5e3 * m)));
|
||||
static_assert(same(width<metre, int>(2 * m) - width<metre, int>(3 * m), width<metre, int>(-1 * m)));
|
||||
static_assert(same(width<metre, int>(2 * m) - width<metre, double>(3. * m), width<metre, double>(-1. * m)));
|
||||
static_assert(same(width<metre, double>(2. * m) - width<metre, int>(3 * m), width<metre, double>(-1. * m)));
|
||||
static_assert(same(width<metre, double>(2e3 * m) - width<kilometre, int>(3 * km), width<metre, double>(-1e3 * m)));
|
||||
static_assert(comp(width<metre, double>(2e3 * m) - width<kilometre, int>(3 * km), width<metre, double>(-1e3 * m)));
|
||||
|
||||
static_assert(
|
||||
is_same_v<decltype((width<metre, std::uint8_t>(0 * m) + width<metre, std::uint8_t>(0 * m)).common().number()),
|
||||
@@ -531,131 +531,131 @@ static_assert(same(2 * width<metre, int>(3 * m), width<metre, int>(6 * m)));
|
||||
static_assert(same(2 * width<metre, double>(3. * m), width<metre, double>(6. * m)));
|
||||
static_assert(same(2. * width<metre, int>(3 * m), width<metre, double>(6. * m)));
|
||||
|
||||
static_assert(same(width<metre, int>(2 * m) * quantity(3), width<metre, int>(6 * m)));
|
||||
static_assert(same(width<metre, int>(2 * m) * quantity(3.), width<metre, double>(6. * m)));
|
||||
static_assert(same(width<metre, double>(2. * m) * quantity(3), width<metre, double>(6. * m)));
|
||||
static_assert(same(quantity(2) * width<metre, int>(3 * m), width<metre, int>(6 * m)));
|
||||
static_assert(same(quantity(2) * width<metre, double>(3. * m), width<metre, double>(6. * m)));
|
||||
static_assert(same(quantity(2.) * width<metre, int>(3 * m), width<metre, double>(6. * m)));
|
||||
static_assert(comp(width<metre, int>(2 * m) * quantity(3), width<metre, int>(6 * m)));
|
||||
static_assert(comp(width<metre, int>(2 * m) * quantity(3.), width<metre, double>(6. * m)));
|
||||
static_assert(comp(width<metre, double>(2. * m) * quantity(3), width<metre, double>(6. * m)));
|
||||
static_assert(comp(quantity(2) * width<metre, int>(3 * m), width<metre, int>(6 * m)));
|
||||
static_assert(comp(quantity(2) * width<metre, double>(3. * m), width<metre, double>(6. * m)));
|
||||
static_assert(comp(quantity(2.) * width<metre, int>(3 * m), width<metre, double>(6. * m)));
|
||||
|
||||
static_assert(same(width<metre, int>(2 * m) * quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(3),
|
||||
static_assert(comp(width<metre, int>(2 * m) * quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(3),
|
||||
width<metre, int>(6 * m)));
|
||||
static_assert(same(width<metre, int>(2 * m) * quantity_kind<downcast_kind<width_kind, dim_one>, one, double>(3.),
|
||||
static_assert(comp(width<metre, int>(2 * m) * quantity_kind<downcast_kind<width_kind, dim_one>, one, double>(3.),
|
||||
width<metre, double>(6. * m)));
|
||||
static_assert(same(width<metre, double>(2. * m) * quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(3),
|
||||
static_assert(comp(width<metre, double>(2. * m) * quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(3),
|
||||
width<metre, double>(6. * m)));
|
||||
static_assert(same(quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(2) * width<metre, int>(3 * m),
|
||||
static_assert(comp(quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(2) * width<metre, int>(3 * m),
|
||||
width<metre, int>(6 * m)));
|
||||
static_assert(same(quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(2) * width<metre, double>(3. * m),
|
||||
static_assert(comp(quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(2) * width<metre, double>(3. * m),
|
||||
width<metre, double>(6. * m)));
|
||||
static_assert(same(quantity_kind<downcast_kind<width_kind, dim_one>, one, double>(2.) * width<metre, int>(3 * m),
|
||||
static_assert(comp(quantity_kind<downcast_kind<width_kind, dim_one>, one, double>(2.) * width<metre, int>(3 * m),
|
||||
width<metre, double>(6. * m)));
|
||||
|
||||
static_assert(same(height<metre, int>(2 * m) * (3 * Hz), rate_of_climb<metre_per_second, int>(6 * (m / s))));
|
||||
static_assert(same(height<metre, int>(2 * m) * (3. * Hz), rate_of_climb<metre_per_second, double>(6. * (m / s))));
|
||||
static_assert(same(height<metre, double>(2. * m) * (3 * Hz), rate_of_climb<metre_per_second, double>(6. * (m / s))));
|
||||
static_assert(same((2 * Hz) * height<metre, int>(3 * m), rate_of_climb<metre_per_second, int>(6 * (m / s))));
|
||||
static_assert(same((2 * Hz) * height<metre, double>(3. * m), rate_of_climb<metre_per_second, double>(6. * (m / s))));
|
||||
static_assert(same((2. * Hz) * height<metre, int>(3 * m), rate_of_climb<metre_per_second, double>(6. * (m / s))));
|
||||
static_assert(comp(height<metre, int>(2 * m) * (3 * Hz), rate_of_climb<metre_per_second, int>(6 * (m / s))));
|
||||
static_assert(comp(height<metre, int>(2 * m) * (3. * Hz), rate_of_climb<metre_per_second, double>(6. * (m / s))));
|
||||
static_assert(comp(height<metre, double>(2. * m) * (3 * Hz), rate_of_climb<metre_per_second, double>(6. * (m / s))));
|
||||
static_assert(comp((2 * Hz) * height<metre, int>(3 * m), rate_of_climb<metre_per_second, int>(6 * (m / s))));
|
||||
static_assert(comp((2 * Hz) * height<metre, double>(3. * m), rate_of_climb<metre_per_second, double>(6. * (m / s))));
|
||||
static_assert(comp((2. * Hz) * height<metre, int>(3 * m), rate_of_climb<metre_per_second, double>(6. * (m / s))));
|
||||
|
||||
static_assert(same(quantity_kind<time_kind, second, int>(2 * s) * (3 * Hz),
|
||||
static_assert(comp(quantity_kind<time_kind, second, int>(2 * s) * (3 * Hz),
|
||||
quantity_kind<downcast_kind<time_kind, dim_one>, one, int>(6)));
|
||||
static_assert(same((3 * Hz) * quantity_kind<time_kind, second, int>(2 * s),
|
||||
static_assert(comp((3 * Hz) * quantity_kind<time_kind, second, int>(2 * s),
|
||||
quantity_kind<downcast_kind<time_kind, dim_one>, one, int>(6)));
|
||||
|
||||
static_assert(same(apples<one, int>(2) * quantity(2), apples<one, int>(4)));
|
||||
static_assert(same(quantity(2) * apples<one, int>(2), apples<one, int>(4)));
|
||||
static_assert(comp(apples<one, int>(2) * quantity(2), apples<one, int>(4)));
|
||||
static_assert(comp(quantity(2) * apples<one, int>(2), apples<one, int>(4)));
|
||||
|
||||
// clang-format off
|
||||
static_assert(same(width<metre, int>(4 * m) * (1 * m), horizontal_area<square_metre, int>(4 * (m * m))));
|
||||
static_assert(same(width<metre, int>(2 * m) * width<metre, int>(2 * m), horizontal_area<square_metre, int>(4 * (m * m))));
|
||||
static_assert(same(width<metre, int>(2 * m) * width<metre, double>(2 * m), horizontal_area<square_metre, double>(4 * (m * m))));
|
||||
static_assert(same(width<metre, double>(2 * m) * width<metre, int>(2 * m), horizontal_area<square_metre, double>(4 * (m * m))));
|
||||
static_assert(comp(width<metre, int>(4 * m) * (1 * m), horizontal_area<square_metre, int>(4 * (m * m))));
|
||||
static_assert(comp(width<metre, int>(2 * m) * width<metre, int>(2 * m), horizontal_area<square_metre, int>(4 * (m * m))));
|
||||
static_assert(comp(width<metre, int>(2 * m) * width<metre, double>(2 * m), horizontal_area<square_metre, double>(4 * (m * m))));
|
||||
static_assert(comp(width<metre, double>(2 * m) * width<metre, int>(2 * m), horizontal_area<square_metre, double>(4 * (m * m))));
|
||||
// clang-format on
|
||||
|
||||
static_assert(same(apples<one, int>(2) * apples<one, int>(2), apples<one, int>(4)));
|
||||
static_assert(same(apples<one, int>(2) * (2 / apples<one, int>(1)), apples<one, int>(4)));
|
||||
static_assert(comp(apples<one, int>(2) * apples<one, int>(2), apples<one, int>(4)));
|
||||
static_assert(comp(apples<one, int>(2) * (2 / apples<one, int>(1)), apples<one, int>(4)));
|
||||
|
||||
static_assert(same(width<kilometre>(4 * m) * (1 * mm), horizontal_area<square_metre>(4 * (m * mm))));
|
||||
static_assert(same(width<kilometre>(2 * m) * width<millimetre>(2 * m), horizontal_area<square_metre>(4 * (m * m))));
|
||||
static_assert(same(width<metre>(2 * m) * (1 / width<metre>(2 * m)),
|
||||
static_assert(comp(width<kilometre>(4 * m) * (1 * mm), horizontal_area<square_metre>(4 * (m * mm))));
|
||||
static_assert(comp(width<kilometre>(2 * m) * width<millimetre>(2 * m), horizontal_area<square_metre>(4 * (m * m))));
|
||||
static_assert(comp(width<metre>(2 * m) * (1 / width<metre>(2 * m)),
|
||||
quantity_kind<downcast_kind<width_kind, dim_one>, one>(1)));
|
||||
|
||||
static_assert(same(width<metre, int>(2 * m) / 3, width<metre, int>(0 * m)));
|
||||
static_assert(same(width<metre, int>(2 * m) / 3., width<metre, double>(2 / 3. * m)));
|
||||
static_assert(same(width<metre, double>(2. * m) / 3, width<metre, double>(2. / 3 * m)));
|
||||
|
||||
static_assert(same(width<metre, int>(2 * m) / quantity(3), width<metre, int>(0 * m)));
|
||||
static_assert(same(width<metre, int>(2 * m) / quantity(3.), width<metre, double>(2 / 3. * m)));
|
||||
static_assert(same(width<metre, double>(2. * m) / quantity(3), width<metre, double>(2. / 3 * m)));
|
||||
static_assert(comp(width<metre, int>(2 * m) / quantity(3), width<metre, int>(0 * m)));
|
||||
static_assert(comp(width<metre, int>(2 * m) / quantity(3.), width<metre, double>(2 / 3. * m)));
|
||||
static_assert(comp(width<metre, double>(2. * m) / quantity(3), width<metre, double>(2. / 3 * m)));
|
||||
|
||||
static_assert(same(width<metre, int>(2 * m) / quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(3),
|
||||
static_assert(comp(width<metre, int>(2 * m) / quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(3),
|
||||
width<metre, int>(0 * m)));
|
||||
static_assert(same(width<metre, int>(2 * m) / quantity_kind<downcast_kind<width_kind, dim_one>, one, double>(3.),
|
||||
static_assert(comp(width<metre, int>(2 * m) / quantity_kind<downcast_kind<width_kind, dim_one>, one, double>(3.),
|
||||
width<metre, double>(2 / 3. * m)));
|
||||
static_assert(same(width<metre, double>(2. * m) / quantity_kind<downcast_kind<width_kind, dim_one>, one, double>(3),
|
||||
static_assert(comp(width<metre, double>(2. * m) / quantity_kind<downcast_kind<width_kind, dim_one>, one, double>(3),
|
||||
width<metre, double>(2. / 3 * m)));
|
||||
|
||||
static_assert(same(2 / quantity_kind<time_kind, second, int>(3 * s),
|
||||
static_assert(comp(2 / quantity_kind<time_kind, second, int>(3 * s),
|
||||
quantity_kind<downcast_kind<time_kind, dim_frequency>, hertz, int>(2 / 3 / (1 * s))));
|
||||
static_assert(same(2 / quantity_kind<time_kind, second, double>(3. * s),
|
||||
static_assert(comp(2 / quantity_kind<time_kind, second, double>(3. * s),
|
||||
quantity_kind<downcast_kind<time_kind, dim_frequency>, hertz, double>(2 / 3. / (1 * s))));
|
||||
static_assert(same(2. / quantity_kind<time_kind, second, int>(3 * s),
|
||||
static_assert(comp(2. / quantity_kind<time_kind, second, int>(3 * s),
|
||||
quantity_kind<downcast_kind<time_kind, dim_frequency>, hertz, double>(2 / 3. / (1 * s))));
|
||||
|
||||
static_assert(same(quantity(2) / quantity_kind<time_kind, second, int>(3 * s),
|
||||
static_assert(comp(quantity(2) / quantity_kind<time_kind, second, int>(3 * s),
|
||||
quantity_kind<downcast_kind<time_kind, dim_frequency>, hertz, int>(2 / 3 / (1 * s))));
|
||||
static_assert(same(quantity(2) / quantity_kind<time_kind, second, double>(3. * s),
|
||||
static_assert(comp(quantity(2) / quantity_kind<time_kind, second, double>(3. * s),
|
||||
quantity_kind<downcast_kind<time_kind, dim_frequency>, hertz, double>(2 / 3. / (1 * s))));
|
||||
static_assert(same(quantity(2.) / quantity_kind<time_kind, second, int>(3 * s),
|
||||
static_assert(comp(quantity(2.) / quantity_kind<time_kind, second, int>(3 * s),
|
||||
quantity_kind<downcast_kind<time_kind, dim_frequency>, hertz, double>(2 / 3. / (1 * s))));
|
||||
|
||||
static_assert(same(quantity_kind<downcast_kind<time_kind, dim_one>, one, int>(2) /
|
||||
static_assert(comp(quantity_kind<downcast_kind<time_kind, dim_one>, one, int>(2) /
|
||||
quantity_kind<time_kind, second, int>(3 * s),
|
||||
quantity_kind<downcast_kind<time_kind, dim_frequency>, hertz, int>(2 / 3 / (1 * s))));
|
||||
static_assert(same(quantity_kind<downcast_kind<time_kind, dim_one>, one, int>(2) /
|
||||
static_assert(comp(quantity_kind<downcast_kind<time_kind, dim_one>, one, int>(2) /
|
||||
quantity_kind<time_kind, second, double>(3. * s),
|
||||
quantity_kind<downcast_kind<time_kind, dim_frequency>, hertz, double>(2 / 3. / (1 * s))));
|
||||
static_assert(same(quantity_kind<downcast_kind<time_kind, dim_one>, one, double>(2.) /
|
||||
static_assert(comp(quantity_kind<downcast_kind<time_kind, dim_one>, one, double>(2.) /
|
||||
quantity_kind<time_kind, second, int>(3 * s),
|
||||
quantity_kind<downcast_kind<time_kind, dim_frequency>, hertz, double>(2 / 3. / (1 * s))));
|
||||
|
||||
static_assert(same(height<metre, int>(2 * m) / (3 * s), rate_of_climb<metre_per_second, int>(0 * (m / s))));
|
||||
static_assert(same(height<metre, int>(2 * m) / (3. * s), rate_of_climb<metre_per_second, double>(2 / 3. * (m / s))));
|
||||
static_assert(same(height<metre, double>(2. * m) / (3 * s), rate_of_climb<metre_per_second, double>(2. / 3 * (m / s))));
|
||||
static_assert(comp(height<metre, int>(2 * m) / (3 * s), rate_of_climb<metre_per_second, int>(0 * (m / s))));
|
||||
static_assert(comp(height<metre, int>(2 * m) / (3. * s), rate_of_climb<metre_per_second, double>(2 / 3. * (m / s))));
|
||||
static_assert(comp(height<metre, double>(2. * m) / (3 * s), rate_of_climb<metre_per_second, double>(2. / 3 * (m / s))));
|
||||
|
||||
static_assert(same(width<metre, int>(2 * m) * dimensionless<percent, int>(3), width<centimetre, int>(6 * cm)));
|
||||
static_assert(same(dimensionless<percent, int>(2) * width<metre, int>(3 * m), width<centimetre, int>(6 * cm)));
|
||||
static_assert(same(width<metre, int>(2 * m) / dimensionless<percent, double>(3),
|
||||
static_assert(comp(width<metre, int>(2 * m) * dimensionless<percent, int>(3), width<centimetre, int>(6 * cm)));
|
||||
static_assert(comp(dimensionless<percent, int>(2) * width<metre, int>(3 * m), width<centimetre, int>(6 * cm)));
|
||||
static_assert(comp(width<metre, int>(2 * m) / dimensionless<percent, double>(3),
|
||||
width<hectometre, double>(2. / 3 * hm)));
|
||||
static_assert(same(width<metre, int>(2 * m) % dimensionless<percent, int>(3), width<metre, int>(2 * m)));
|
||||
|
||||
static_assert(same(height<metre, int>(2 * m) / (3 * m),
|
||||
static_assert(comp(height<metre, int>(2 * m) / (3 * m),
|
||||
quantity_kind<downcast_kind<height_kind, dim_one>, one, int>(0)));
|
||||
static_assert(same(height<metre, int>(2 * m) / (3. * m),
|
||||
static_assert(comp(height<metre, int>(2 * m) / (3. * m),
|
||||
quantity_kind<downcast_kind<height_kind, dim_one>, one, double>(2 / 3.)));
|
||||
static_assert(same(height<metre, double>(2. * m) / (3 * m),
|
||||
static_assert(comp(height<metre, double>(2. * m) / (3 * m),
|
||||
quantity_kind<downcast_kind<height_kind, dim_one>, one, double>(2. / 3)));
|
||||
|
||||
static_assert(same((2 * m) / height<metre, int>(3 * m),
|
||||
static_assert(comp((2 * m) / height<metre, int>(3 * m),
|
||||
quantity_kind<downcast_kind<height_kind, dim_one>, one, int>(0)));
|
||||
static_assert(same((2 * m) / height<metre, double>(3. * m),
|
||||
static_assert(comp((2 * m) / height<metre, double>(3. * m),
|
||||
quantity_kind<downcast_kind<height_kind, dim_one>, one, double>(2 / 3.)));
|
||||
static_assert(same((2. * m) / height<metre, int>(3 * m),
|
||||
static_assert(comp((2. * m) / height<metre, int>(3 * m),
|
||||
quantity_kind<downcast_kind<height_kind, dim_one>, one, double>(2. / 3)));
|
||||
|
||||
static_assert(same(width<metre, int>(8 * m) / width<metre, int>(2 * m),
|
||||
static_assert(comp(width<metre, int>(8 * m) / width<metre, int>(2 * m),
|
||||
quantity_kind<downcast_kind<width_kind, dim_one>, one, int>(4)));
|
||||
static_assert(same(width<metre, int>(8 * m) / width<metre, double>(2 * m),
|
||||
static_assert(comp(width<metre, int>(8 * m) / width<metre, double>(2 * m),
|
||||
quantity_kind<downcast_kind<width_kind, dim_one>, one, double>(4.0)));
|
||||
static_assert(same(width<metre, double>(8 * m) / width<metre, int>(2 * m),
|
||||
static_assert(comp(width<metre, double>(8 * m) / width<metre, int>(2 * m),
|
||||
quantity_kind<downcast_kind<width_kind, dim_one>, one, double>(4.0)));
|
||||
|
||||
static_assert(same(apples<one, int>(8) / apples<one, int>(2), apples<one, int>(4)));
|
||||
static_assert(same(apples<one, int>(8) / (2 / apples<one, int>(1)), apples<one, int>(4)));
|
||||
static_assert(comp(apples<one, int>(8) / apples<one, int>(2), apples<one, int>(4)));
|
||||
static_assert(comp(apples<one, int>(8) / (2 / apples<one, int>(1)), apples<one, int>(4)));
|
||||
|
||||
static_assert(same(horizontal_area<square_metre>(8 * (m * m)) / width<metre>(2 * m), width<metre>(4 * m)));
|
||||
static_assert(same(horizontal_area<square_metre>(4 * (m * m)) / (1 * m), width<metre>(4 * m)));
|
||||
static_assert(comp(horizontal_area<square_metre>(8 * (m * m)) / width<metre>(2 * m), width<metre>(4 * m)));
|
||||
static_assert(comp(horizontal_area<square_metre>(4 * (m * m)) / (1 * m), width<metre>(4 * m)));
|
||||
|
||||
static_assert(same(width<metre, int>(2 * m) % 3, width<metre, int>(2 * m)));
|
||||
static_assert(same(width<metre, int>(3 * m) % width<metre, int>(2 * m), width<metre, int>(1 * m)));
|
||||
@@ -800,7 +800,7 @@ static_assert(same(quantity_kind_cast<cgs_width_kind>(width<centimetre, int>(1 *
|
||||
static_assert(same(quantity_kind_cast<cgs_width_kind, cgs::centimetre>(width<centimetre, int>(1 * cm)), cgs_width<cgs::centimetre, int>(1 * cgs_cm)));
|
||||
static_assert(same(quantity_kind_cast<cgs_width_kind>(width<metre, int>(1 * m)), cgs_width<metre, int>(1 * m)));
|
||||
static_assert(same(quantity_kind_cast<cgs_width_kind, metre>(width<metre, int>(1 * m)), cgs_width<metre, int>(1 * m)));
|
||||
static_assert(same(quantity_kind_cast<cgs::dim_length>(width<centimetre, int>(1 * cm)), width<cgs::centimetre, int>(1 * cgs_cm)));
|
||||
static_assert(comp(quantity_kind_cast<cgs::dim_length>(width<centimetre, int>(1 * cm)), width<cgs::centimetre, int>(1 * cgs_cm)));
|
||||
static_assert(same(quantity_kind_cast<length<kilometre, int>>(width<metre, int>(1 * m)), width<kilometre, int>(0 * km)));
|
||||
static_assert(same(quantity_kind_cast<length<centimetre, int>>(width<metre, int>(1 * m)), width<centimetre, int>(100 * cm)));
|
||||
static_assert(same(quantity_kind_cast<length<centimetre, int>>(width<metre, double>(0.01 * m)), width<centimetre, int>(1 * cm)));
|
||||
|
||||
@@ -250,7 +250,7 @@ static_assert(abscissa<metre>{}.relative().common() == 0 * m);
|
||||
// CTAD
|
||||
/////////
|
||||
|
||||
static_assert(same(quantity_point_kind(width<metre, int>(0 * m)), abscissa<metre, int>{}));
|
||||
static_assert(comp(quantity_point_kind(width<metre, int>(0 * m)), abscissa<metre, int>{}));
|
||||
static_assert(same(quantity_point_kind(abscissa<metre, int>(0 * m)), abscissa<metre, int>{}));
|
||||
|
||||
|
||||
@@ -500,16 +500,16 @@ static_assert(invalid_compound_assignments_<time_point_kind, second, std::chrono
|
||||
/////////////////////////
|
||||
|
||||
// clang-format off
|
||||
static_assert(same(abscissa<metre, int>(2 * m) + width<metre, int>(3 * m), abscissa<metre, int>(5 * m)));
|
||||
static_assert(same(abscissa<metre, int>(2 * m) + width<metre, double>(3. * m), abscissa<metre, double>(5. * m)));
|
||||
static_assert(same(abscissa<metre, double>(2. * m) + width<metre, int>(3 * m), abscissa<metre, double>(5. * m)));
|
||||
static_assert(same(abscissa<kilometre, int>(2 * km) + width<metre, double>(3e3 * m), abscissa<metre, double>(5e3 * m)));
|
||||
static_assert(same(abscissa<metre, double>(2e3 * m) + width<kilometre, int>(3 * km), abscissa<metre, double>(5e3 * m)));
|
||||
static_assert(same(width<metre, int>(2 * m) + abscissa<metre, int>(3 * m), abscissa<metre, int>(5 * m)));
|
||||
static_assert(same(width<metre, int>(2 * m) + abscissa<metre, double>(3. * m), abscissa<metre, double>(5. * m)));
|
||||
static_assert(same(width<metre, double>(2. * m) + abscissa<metre, int>(3 * m), abscissa<metre, double>(5. * m)));
|
||||
static_assert(same(width<kilometre, int>(2 * km) + abscissa<metre, double>(3e3 * m), abscissa<metre, double>(5e3 * m)));
|
||||
static_assert(same(width<metre, double>(2e3 * m) + abscissa<kilometre, int>(3 * km), abscissa<metre, double>(5e3 * m)));
|
||||
static_assert(comp(abscissa<metre, int>(2 * m) + width<metre, int>(3 * m), abscissa<metre, int>(5 * m)));
|
||||
static_assert(comp(abscissa<metre, int>(2 * m) + width<metre, double>(3. * m), abscissa<metre, double>(5. * m)));
|
||||
static_assert(comp(abscissa<metre, double>(2. * m) + width<metre, int>(3 * m), abscissa<metre, double>(5. * m)));
|
||||
static_assert(comp(abscissa<kilometre, int>(2 * km) + width<metre, double>(3e3 * m), abscissa<metre, double>(5e3 * m)));
|
||||
static_assert(comp(abscissa<metre, double>(2e3 * m) + width<kilometre, int>(3 * km), abscissa<metre, double>(5e3 * m)));
|
||||
static_assert(comp(width<metre, int>(2 * m) + abscissa<metre, int>(3 * m), abscissa<metre, int>(5 * m)));
|
||||
static_assert(comp(width<metre, int>(2 * m) + abscissa<metre, double>(3. * m), abscissa<metre, double>(5. * m)));
|
||||
static_assert(comp(width<metre, double>(2. * m) + abscissa<metre, int>(3 * m), abscissa<metre, double>(5. * m)));
|
||||
static_assert(comp(width<kilometre, int>(2 * km) + abscissa<metre, double>(3e3 * m), abscissa<metre, double>(5e3 * m)));
|
||||
static_assert(comp(width<metre, double>(2e3 * m) + abscissa<kilometre, int>(3 * km), abscissa<metre, double>(5e3 * m)));
|
||||
static_assert(!std::is_invocable_v<std::plus<>, abscissa<metre>, double>);
|
||||
static_assert(!std::is_invocable_v<std::plus<>, abscissa<metre>, length<metre>>);
|
||||
static_assert(!std::is_invocable_v<std::plus<>, abscissa<metre>, quantity_point<dynamic_origin<dim_length>, metre>>);
|
||||
@@ -522,16 +522,16 @@ static_assert(!std::is_invocable_v<std::plus<>, quantity_point<dynamic_origin<di
|
||||
static_assert(!std::is_invocable_v<std::plus<>, length<metre>, abscissa<metre>>);
|
||||
static_assert(!std::is_invocable_v<std::plus<>, double, abscissa<metre>>);
|
||||
|
||||
static_assert(same(abscissa<metre, int>(2 * m) - width<metre, int>(3 * m), abscissa<metre, int>(-1 * m)));
|
||||
static_assert(same(abscissa<metre, int>(2 * m) - width<metre, double>(3. * m), abscissa<metre, double>(-1. * m)));
|
||||
static_assert(same(abscissa<metre, double>(2. * m) - width<metre, int>(3 * m), abscissa<metre, double>(-1. * m)));
|
||||
static_assert(same(abscissa<kilometre, int>(2 * km) - width<metre, double>(3e3 * m), abscissa<metre, double>(-1e3 * m)));
|
||||
static_assert(same(abscissa<metre, double>(2e3 * m) - width<kilometre, int>(3 * km), abscissa<metre, double>(-1e3 * m)));
|
||||
static_assert(comp(abscissa<metre, int>(2 * m) - width<metre, int>(3 * m), abscissa<metre, int>(-1 * m)));
|
||||
static_assert(comp(abscissa<metre, int>(2 * m) - width<metre, double>(3. * m), abscissa<metre, double>(-1. * m)));
|
||||
static_assert(comp(abscissa<metre, double>(2. * m) - width<metre, int>(3 * m), abscissa<metre, double>(-1. * m)));
|
||||
static_assert(comp(abscissa<kilometre, int>(2 * km) - width<metre, double>(3e3 * m), abscissa<metre, double>(-1e3 * m)));
|
||||
static_assert(comp(abscissa<metre, double>(2e3 * m) - width<kilometre, int>(3 * km), abscissa<metre, double>(-1e3 * m)));
|
||||
static_assert(same(abscissa<metre, int>(2 * m) - abscissa<metre, int>(3 * m), width<metre, int>(-1 * m)));
|
||||
static_assert(same(abscissa<metre, int>(2 * m) - abscissa<metre, double>(3. * m), width<metre, double>(-1. * m)));
|
||||
static_assert(same(abscissa<metre, double>(2. * m) - abscissa<metre, int>(3 * m), width<metre, double>(-1. * m)));
|
||||
static_assert(same(abscissa<kilometre, int>(2 * km) - abscissa<metre, double>(3e3 * m), width<metre, double>(-1e3 * m)));
|
||||
static_assert(same(abscissa<metre, double>(2e3 * m) - abscissa<kilometre, int>(3 * km), width<metre, double>(-1e3 * m)));
|
||||
static_assert(comp(abscissa<kilometre, int>(2 * km) - abscissa<metre, double>(3e3 * m), width<metre, double>(-1e3 * m)));
|
||||
static_assert(comp(abscissa<metre, double>(2e3 * m) - abscissa<kilometre, int>(3 * km), width<metre, double>(-1e3 * m)));
|
||||
static_assert(!std::is_invocable_v<std::minus<>, abscissa<metre>, double>);
|
||||
static_assert(!std::is_invocable_v<std::minus<>, abscissa<metre>, length<metre>>);
|
||||
static_assert(!std::is_invocable_v<std::minus<>, abscissa<metre>, quantity_point<dynamic_origin<dim_length>, metre>>);
|
||||
@@ -634,41 +634,41 @@ static_assert(same(quantity_point_kind_cast<abscissa<metre, double>>(abscissa<me
|
||||
static_assert(same(quantity_point_kind_cast<abscissa<kilometre, int>>(abscissa<metre, int>(999 * m)), abscissa<kilometre, int>(0 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<abscissa<kilometre, int>>(abscissa<metre, int>(1000 * m)), abscissa<kilometre, int>(1 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<abscissa<kilometre, double>>(abscissa<metre, int>(999 * m)), abscissa<kilometre, double>(0.999 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<width<metre, int>>(abscissa<metre, int>(1 * m)), abscissa<metre, int>(1 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<width<metre, double>>(abscissa<metre, int>(1 * m)), abscissa<metre, double>(1.0 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<width<kilometre, int>>(abscissa<metre, int>(999 * m)), abscissa<kilometre, int>(0 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<width<kilometre, int>>(abscissa<metre, int>(1000 * m)), abscissa<kilometre, int>(1 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<width<kilometre, double>>(abscissa<metre, int>(999 * m)), abscissa<kilometre, double>(0.999 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<double>(abscissa<metre, int>(1 * m)), abscissa<metre, double>(1.0 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<metre>(abscissa<metre, int>(1 * m)), abscissa<metre, int>(1 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<kilometre>(abscissa<metre, int>(999 * m)), abscissa<kilometre, int>(0 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<kilometre>(abscissa<metre, int>(1000 * m)), abscissa<kilometre, int>(1 * km)));
|
||||
static_assert(comp(quantity_point_kind_cast<width<metre, int>>(abscissa<metre, int>(1 * m)), abscissa<metre, int>(1 * m)));
|
||||
static_assert(comp(quantity_point_kind_cast<width<metre, double>>(abscissa<metre, int>(1 * m)), abscissa<metre, double>(1.0 * m)));
|
||||
static_assert(comp(quantity_point_kind_cast<width<kilometre, int>>(abscissa<metre, int>(999 * m)), abscissa<kilometre, int>(0 * km)));
|
||||
static_assert(comp(quantity_point_kind_cast<width<kilometre, int>>(abscissa<metre, int>(1000 * m)), abscissa<kilometre, int>(1 * km)));
|
||||
static_assert(comp(quantity_point_kind_cast<width<kilometre, double>>(abscissa<metre, int>(999 * m)), abscissa<kilometre, double>(0.999 * km)));
|
||||
static_assert(comp(quantity_point_kind_cast<double>(abscissa<metre, int>(1 * m)), abscissa<metre, double>(1.0 * m)));
|
||||
static_assert(comp(quantity_point_kind_cast<metre>(abscissa<metre, int>(1 * m)), abscissa<metre, int>(1 * m)));
|
||||
static_assert(comp(quantity_point_kind_cast<kilometre>(abscissa<metre, int>(999 * m)), abscissa<kilometre, int>(0 * km)));
|
||||
static_assert(comp(quantity_point_kind_cast<kilometre>(abscissa<metre, int>(1000 * m)), abscissa<kilometre, int>(1 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<ordinate<metre, int>>(abscissa<metre, int>(1 * m)), ordinate<metre, int>(1 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<ordinate<metre, double>>(abscissa<metre, int>(1 * m)), ordinate<metre, double>(1.0 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<ordinate<kilometre, int>>(abscissa<metre, int>(999 * m)), ordinate<kilometre, int>(0 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<ordinate<kilometre, int>>(abscissa<metre, int>(1000 * m)), ordinate<kilometre, int>(1 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<ordinate<kilometre, double>>(abscissa<metre, int>(999 * m)), ordinate<kilometre, double>(0.999 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<height<metre, int>>(abscissa<metre, int>(1 * m)), ordinate<metre, int>(1 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<height<metre, double>>(abscissa<metre, int>(1 * m)), ordinate<metre, double>(1.0 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<height<kilometre, int>>(abscissa<metre, int>(999 * m)), ordinate<kilometre, int>(0 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<height<kilometre, int>>(abscissa<metre, int>(1000 * m)), ordinate<kilometre, int>(1 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<height<kilometre, double>>(abscissa<metre, int>(999 * m)), ordinate<kilometre, double>(0.999 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<height_kind>(abscissa<metre, int>(1 * m)), ordinate<metre, int>(1 * m)));
|
||||
static_assert(comp(quantity_point_kind_cast<height<metre, int>>(abscissa<metre, int>(1 * m)), ordinate<metre, int>(1 * m)));
|
||||
static_assert(comp(quantity_point_kind_cast<height<metre, double>>(abscissa<metre, int>(1 * m)), ordinate<metre, double>(1.0 * m)));
|
||||
static_assert(comp(quantity_point_kind_cast<height<kilometre, int>>(abscissa<metre, int>(999 * m)), ordinate<kilometre, int>(0 * km)));
|
||||
static_assert(comp(quantity_point_kind_cast<height<kilometre, int>>(abscissa<metre, int>(1000 * m)), ordinate<kilometre, int>(1 * km)));
|
||||
static_assert(comp(quantity_point_kind_cast<height<kilometre, double>>(abscissa<metre, int>(999 * m)), ordinate<kilometre, double>(0.999 * km)));
|
||||
static_assert(comp(quantity_point_kind_cast<height_kind>(abscissa<metre, int>(1 * m)), ordinate<metre, int>(1 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<ordinate_kind, metre>(abscissa<metre, int>(1 * m)), ordinate<metre, int>(1 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<ordinate_kind, kilometre>(abscissa<metre, int>(999 * m)), ordinate<kilometre, int>(0 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<ordinate_kind, kilometre>(abscissa<metre, int>(1000 * m)), ordinate<kilometre, int>(1 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<cgs_width<cgs::centimetre, int>>(abscissa<centimetre, int>(1 * cm)), quantity_point_kind(cgs_width<cgs::centimetre, int>(1 * cgs_cm))));
|
||||
static_assert(same(quantity_point_kind_cast<cgs_width_kind>(abscissa<centimetre, int>(1 * cm)), quantity_point_kind(cgs_width<cgs::centimetre, int>(1 * cgs_cm))));
|
||||
static_assert(same(quantity_point_kind_cast<altitude_kind>(abscissa<centimetre, int>(1 * cm)), altitude<cgs::centimetre, int>(1 * cgs_cm)));
|
||||
static_assert(comp(quantity_point_kind_cast<altitude_kind>(abscissa<centimetre, int>(1 * cm)), altitude<cgs::centimetre, int>(1 * cgs_cm)));
|
||||
static_assert(same(quantity_point_kind_cast<altitude_kind, cgs::centimetre>(abscissa<centimetre, int>(1 * cm)), altitude<cgs::centimetre, int>(1 * cgs_cm)));
|
||||
static_assert(same(quantity_point_kind_cast<cgs_width_kind>(abscissa<metre, int>(1 * m)), quantity_point_kind(cgs_width<metre, int>(1 * m))));
|
||||
static_assert(same(quantity_point_kind_cast<altitude_kind>(abscissa<metre, int>(1 * m)), altitude<metre, int>(1 * m)));
|
||||
static_assert(comp(quantity_point_kind_cast<altitude_kind>(abscissa<metre, int>(1 * m)), altitude<metre, int>(1 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<altitude_kind, metre>(abscissa<metre, int>(1 * m)), altitude<metre, int>(1 * m)));
|
||||
static_assert(same(quantity_point_kind_cast<cgs::dim_length>(abscissa<centimetre, int>(1 * cm)), abscissa<cgs::centimetre, int>(1 * cgs_cm)));
|
||||
static_assert(same(quantity_point_kind_cast<length<kilometre, int>>(abscissa<metre, int>(1 * m)), abscissa<kilometre, int>(0 * km)));
|
||||
static_assert(same(quantity_point_kind_cast<length<centimetre, int>>(abscissa<metre, int>(1 * m)), abscissa<centimetre, int>(100 * cm)));
|
||||
static_assert(same(quantity_point_kind_cast<length<centimetre, int>>(abscissa<metre, double>(0.01 * m)), abscissa<centimetre, int>(1 * cm)));
|
||||
static_assert(same(quantity_point_kind_cast<length<centimetre, int>>(abscissa<cgs::centimetre, int>(1 * cgs_cm)), abscissa<cgs::centimetre, int>(1 * cgs_cm)));
|
||||
static_assert(comp(quantity_point_kind_cast<cgs::dim_length>(abscissa<centimetre, int>(1 * cm)), abscissa<cgs::centimetre, int>(1 * cgs_cm)));
|
||||
static_assert(comp(quantity_point_kind_cast<length<kilometre, int>>(abscissa<metre, int>(1 * m)), abscissa<kilometre, int>(0 * km)));
|
||||
static_assert(comp(quantity_point_kind_cast<length<centimetre, int>>(abscissa<metre, int>(1 * m)), abscissa<centimetre, int>(100 * cm)));
|
||||
static_assert(comp(quantity_point_kind_cast<length<centimetre, int>>(abscissa<metre, double>(0.01 * m)), abscissa<centimetre, int>(1 * cm)));
|
||||
static_assert(comp(quantity_point_kind_cast<length<centimetre, int>>(abscissa<cgs::centimetre, int>(1 * cgs_cm)), abscissa<cgs::centimetre, int>(1 * cgs_cm)));
|
||||
static_assert(same(quantity_point_kind_cast<screen_si_cgs_width<metre, int>>(screen_si_width<metre, int>(1 * m)), screen_si_cgs_width<metre, int>(1 * m)));
|
||||
// clang-format on
|
||||
template<typename Int>
|
||||
|
||||
@@ -275,11 +275,11 @@ struct derived_quantity : quantity<typename Q::dimension, typename Q::unit, Rep>
|
||||
static_assert(detail::is_quantity<derived_quantity<double, si::length<metre>, "NTTP type description">>);
|
||||
constexpr isq::Length auto get_length_derived_quantity() noexcept
|
||||
{
|
||||
derived_quantity<double, si::length<metre>, "NTTP type description"> a{};
|
||||
a += 1_q_m;
|
||||
a = a + 1_q_m;
|
||||
a *= 0.5;
|
||||
return a;
|
||||
derived_quantity<double, si::length<metre>, "NTTP type description"> dist{};
|
||||
dist += 1_q_m;
|
||||
dist = dist + 1_q_m;
|
||||
dist *= 0.5;
|
||||
return dist;
|
||||
}
|
||||
static_assert(get_length_derived_quantity() == 1_q_m);
|
||||
|
||||
@@ -479,11 +479,11 @@ static_assert(invalid_binary_operations<metre>);
|
||||
static_assert(is_same_v<decltype(1_q_m + 1_q_m), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1_q_m - 1_q_m), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1_q_m * 1), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1_q_m * quantity{1}), length<metre, std::int64_t>>);
|
||||
static_assert(compare<decltype(1_q_m * quantity{1}), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1 * 1_q_m), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(quantity{1} * 1_q_m), length<metre, std::int64_t>>);
|
||||
static_assert(compare<decltype(quantity{1} * 1_q_m), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1_q_m / 1), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1_q_m / quantity{1}), length<metre, std::int64_t>>);
|
||||
static_assert(compare<decltype(1_q_m / quantity{1}), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1_q_m % 1), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1_q_m % quantity{1}), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1_q_m % 1_q_m), length<metre, std::int64_t>>);
|
||||
@@ -513,12 +513,12 @@ static_assert(
|
||||
is_same_v<decltype(1_q_m * 1.L), length<metre, long double>>); // TODO should we address fundamental types implicit
|
||||
// truncating conversions with concepts?
|
||||
static_assert(is_same_v<decltype(1 * 1._q_m), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1_q_m * quantity{1.L}),
|
||||
length<metre, long double>>); // TODO should we address fundamental types implicit truncating
|
||||
// conversions with concepts?
|
||||
static_assert(is_same_v<decltype(quantity{1} * 1._q_m), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_m * quantity{1.L}),
|
||||
length<metre, long double>>); // TODO should we address fundamental types implicit truncating
|
||||
// conversions with concepts?
|
||||
static_assert(compare<decltype(quantity{1} * 1._q_m), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1_q_m / 1.L), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1_q_m / quantity{1.L}), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_m / quantity{1.L}), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_m * dimensionless<percent, long double>(1)), length<centimetre, long double>>);
|
||||
static_assert(compare<decltype(dimensionless<percent, std::int64_t>(1) * 1._q_m), length<centimetre, long double>>);
|
||||
static_assert(compare<decltype(1_q_m * 1._q_m), area<square_metre, long double>>);
|
||||
@@ -537,10 +537,10 @@ static_assert(is_same_v<decltype(1._q_m + 1_q_m), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1._q_m - 1_q_m), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1._q_m * 1), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1.L * 1_q_m), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1._q_m * quantity{1}), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(quantity{1.L} * 1_q_m), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1._q_m * quantity{1}), length<metre, long double>>);
|
||||
static_assert(compare<decltype(quantity{1.L} * 1_q_m), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1._q_m / 1), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1._q_m / quantity{1}), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1._q_m / quantity{1}), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1._q_m * dimensionless<percent, std::int64_t>(1)), length<centimetre, long double>>);
|
||||
static_assert(compare<decltype(dimensionless<percent, long double>(1) * 1_q_m), length<centimetre, long double>>);
|
||||
static_assert(compare<decltype(1._q_m / dimensionless<percent, std::int64_t>(1)), length<hectometre, long double>>);
|
||||
@@ -552,25 +552,25 @@ static_assert(compare<decltype(dimensionless<percent, long double>(1) / 1_q_s),
|
||||
frequency<scaled_unit<as_magnitude<ratio(1, 100)>(), hertz>, long double>>);
|
||||
|
||||
// different units
|
||||
static_assert(is_same_v<decltype(1_q_m + 1_q_km), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1._q_m + 1_q_km), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1_q_m + 1._q_km), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1._q_m + 1._q_km), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_m + 1_q_km), length<metre, std::int64_t>>);
|
||||
static_assert(compare<decltype(1._q_m + 1_q_km), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_m + 1._q_km), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1._q_m + 1._q_km), length<metre, long double>>);
|
||||
|
||||
static_assert(is_same_v<decltype(1_q_km + 1_q_m), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1._q_km + 1_q_m), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1_q_km + 1._q_m), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1._q_km + 1._q_m), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_km + 1_q_m), length<metre, std::int64_t>>);
|
||||
static_assert(compare<decltype(1._q_km + 1_q_m), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_km + 1._q_m), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1._q_km + 1._q_m), length<metre, long double>>);
|
||||
|
||||
static_assert(is_same_v<decltype(1_q_m - 1_q_km), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1._q_m - 1_q_km), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1_q_m - 1._q_km), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1._q_m - 1._q_km), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_m - 1_q_km), length<metre, std::int64_t>>);
|
||||
static_assert(compare<decltype(1._q_m - 1_q_km), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_m - 1._q_km), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1._q_m - 1._q_km), length<metre, long double>>);
|
||||
|
||||
static_assert(is_same_v<decltype(1_q_km - 1_q_m), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1._q_km - 1_q_m), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1_q_km - 1._q_m), length<metre, long double>>);
|
||||
static_assert(is_same_v<decltype(1._q_km - 1._q_m), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_km - 1_q_m), length<metre, std::int64_t>>);
|
||||
static_assert(compare<decltype(1._q_km - 1_q_m), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1_q_km - 1._q_m), length<metre, long double>>);
|
||||
static_assert(compare<decltype(1._q_km - 1._q_m), length<metre, long double>>);
|
||||
|
||||
static_assert(is_same_v<decltype(1_q_m % 1_q_km), length<metre, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1_q_km % 1_q_m), length<kilometre, std::int64_t>>);
|
||||
@@ -891,8 +891,8 @@ static_assert(
|
||||
|
||||
#else
|
||||
|
||||
static_assert(is_same_v<decltype(10_q_m / 5_q_s), speed<metre_per_second, std::int64_t>>);
|
||||
static_assert(is_same_v<decltype(1_q_mm + 1_q_km), length<millimetre, std::int64_t>>);
|
||||
static_assert(compare<decltype(10_q_m / 5_q_s), speed<metre_per_second, std::int64_t>>);
|
||||
static_assert(compare<decltype(1_q_mm + 1_q_km), length<millimetre, std::int64_t>>);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -906,19 +906,19 @@ constexpr auto quotient_remainder_theorem(auto q1, auto q2)
|
||||
return q;
|
||||
}
|
||||
|
||||
static_assert(same(quotient_remainder_theorem(3'000 * m, 400 * m), 3'000 * m));
|
||||
static_assert(same(quotient_remainder_theorem(3 * km, 400 * m), 3 * km));
|
||||
static_assert(same(quotient_remainder_theorem(3 * km, 2 * m), 3 * km));
|
||||
static_assert(same(quotient_remainder_theorem(3 * km, 400'000 * mm), 3 * km));
|
||||
static_assert(same(quotient_remainder_theorem(3 * km, 2'000 * mm), 3 * km));
|
||||
static_assert(same(quotient_remainder_theorem(3 * km, 400 * mm), 3 * km));
|
||||
static_assert(same(quotient_remainder_theorem(3 * km, 2 * mm), 3 * km));
|
||||
static_assert(comp(quotient_remainder_theorem(3'000 * m, 400 * m), 3'000 * m));
|
||||
static_assert(comp(quotient_remainder_theorem(3 * km, 400 * m), 3 * km));
|
||||
static_assert(comp(quotient_remainder_theorem(3 * km, 2 * m), 3 * km));
|
||||
static_assert(comp(quotient_remainder_theorem(3 * km, 400'000 * mm), 3 * km));
|
||||
static_assert(comp(quotient_remainder_theorem(3 * km, 2'000 * mm), 3 * km));
|
||||
static_assert(comp(quotient_remainder_theorem(3 * km, 400 * mm), 3 * km));
|
||||
static_assert(comp(quotient_remainder_theorem(3 * km, 2 * mm), 3 * km));
|
||||
static_assert(same(quotient_remainder_theorem(3'000 * m, 400), 3'000 * m));
|
||||
static_assert(same(quotient_remainder_theorem(3'000 * m, quantity(400)), 3'000 * m));
|
||||
static_assert(same(quotient_remainder_theorem(3 * km, quantity(400)), 3 * km));
|
||||
static_assert(same(quotient_remainder_theorem(3 * km, quantity(2)), 3 * km));
|
||||
static_assert(comp(quotient_remainder_theorem(3'000 * m, quantity(400)), 3'000 * m));
|
||||
static_assert(comp(quotient_remainder_theorem(3 * km, quantity(400)), 3 * km));
|
||||
static_assert(comp(quotient_remainder_theorem(3 * km, quantity(2)), 3 * km));
|
||||
static_assert(
|
||||
same(quotient_remainder_theorem(3 * km, dimensionless<scaled_unit<as_magnitude<ratio(1, 1000)>(), one>, int>(400)),
|
||||
comp(quotient_remainder_theorem(3 * km, dimensionless<scaled_unit<as_magnitude<ratio(1, 1000)>(), one>, int>(400)),
|
||||
3 * km));
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "test_tools.h"
|
||||
#include <units/bits/external/hacks.h>
|
||||
#include <units/bits/external/type_traits.h>
|
||||
#include <units/isq/si/area.h>
|
||||
@@ -70,8 +71,8 @@ static_assert([] {
|
||||
const auto duration{2};
|
||||
return length * km / (duration * h);
|
||||
}() == 60_q_km_per_h);
|
||||
static_assert(is_same_v<decltype(std::int64_t{120} * km / (2 * h)), decltype(60_q_km_per_h)>);
|
||||
static_assert(is_same_v<decltype(120.L * km / (2 * h)), decltype(60._q_km_per_h)>);
|
||||
static_assert(compare<decltype(std::int64_t{120} * km / (2 * h)), decltype(60_q_km_per_h)>);
|
||||
static_assert(compare<decltype(120.L * km / (2 * h)), decltype(60._q_km_per_h)>);
|
||||
|
||||
static_assert(1. / 4 * m2 == 1._q_m2 / 4);
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ static_assert(si::mass<si::hep::eV_per_c2>(1'000) == si::hep::mass<si::hep::keV_
|
||||
|
||||
// momentum
|
||||
static_assert(si::hep::momentum<si::hep::eV_per_c>(1'000'000) == si::hep::momentum<si::hep::MeV_per_c>(1));
|
||||
static_assert(si::hep::momentum<si::hep::eV_per_c>(1'000'000) == si::momentum<si::hep::MeV_per_c>(1));
|
||||
static_assert(si::momentum<si::hep::eV_per_c>(1'000'000) == si::hep::momentum<si::hep::MeV_per_c>(1));
|
||||
|
||||
// area
|
||||
static_assert(si::area<si::hep::barn>(1e28) == si::area<si::square_metre>(1));
|
||||
|
||||
@@ -276,8 +276,17 @@ static_assert(10_q_m * 10_q_m == 100_q_m2);
|
||||
static_assert(100_q_m2 / 10_q_m == 10_q_m);
|
||||
static_assert(10_q_km * 10_q_km == 100_q_km2);
|
||||
static_assert(1_q_m2 == 10'000_q_cm2);
|
||||
|
||||
static_assert(1_q_ca == 1_q_m2);
|
||||
static_assert(1_q_da == 10_q_m2);
|
||||
static_assert(1_q_a == 100_q_m2);
|
||||
static_assert(1_q_daa == 1'000_q_m2);
|
||||
static_assert(1_q_ha == 10'000_q_m2);
|
||||
|
||||
static_assert(centiare::symbol == "ca");
|
||||
static_assert(deciare::symbol == "da");
|
||||
static_assert(are::symbol == "a");
|
||||
static_assert(decare::symbol == "daa");
|
||||
static_assert(hectare::symbol == "ha");
|
||||
|
||||
static_assert(detail::unit_text<dim_area, square_metre>() == basic_symbol_text("m²", "m^2"));
|
||||
|
||||
@@ -123,16 +123,9 @@ constexpr bool ctad_constructible_from(Vs...)
|
||||
return ctad_constructible_from_<T, void, Us..., Vs...>;
|
||||
}
|
||||
|
||||
#if UNITS_DOWNCAST_MODE
|
||||
constexpr auto same = []<std::equality_comparable T>(T l, T r) { return l == r; };
|
||||
#else
|
||||
constexpr auto same = []<typename T, typename U>(T l, U r)
|
||||
requires requires { l == r; }
|
||||
// requires std::equality_comparable_with<T, U> // TODO: Fix #205
|
||||
{
|
||||
return l == r;
|
||||
};
|
||||
#endif
|
||||
constexpr auto comp = // TODO: Fix #205 to use `std::equality_comparable_with<T> U`.
|
||||
[]<typename T, typename U>(T l, U r) requires compare<T, U> { return l == r; };
|
||||
|
||||
template<auto F>
|
||||
requires requires { F(); }
|
||||
|
||||
@@ -94,9 +94,9 @@ static_assert(
|
||||
is_same_v<type_list_split_half<type_list<int, long, double, float>>::second_list, type_list<double, float>>);
|
||||
|
||||
// type_list_merge_sorted
|
||||
struct u0 : named_unit<u0, "u0", no_prefix> {};
|
||||
struct u0 : named_unit<u0, "u0"> {};
|
||||
struct d0 : base_dimension<"d0", u0> {};
|
||||
struct u1 : named_unit<u1, "u1", no_prefix> {};
|
||||
struct u1 : named_unit<u1, "u1"> {};
|
||||
struct d1 : base_dimension<"d1", u1> {};
|
||||
|
||||
static_assert(
|
||||
|
||||
@@ -33,29 +33,29 @@ namespace {
|
||||
using namespace units;
|
||||
using namespace units::isq;
|
||||
|
||||
struct metre : named_unit<metre, "m", si::prefix> {};
|
||||
struct metre : named_unit<metre, "m"> {};
|
||||
struct centimetre : prefixed_unit<centimetre, si::centi, metre> {};
|
||||
struct kilometre : prefixed_unit<kilometre, si::kilo, metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, as_magnitude<ratio(9'144, 1, -4)>(), metre> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, as_magnitude<ratio(1, 3)>(), yard> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", as_magnitude<ratio(9'144, 1, -4)>(), metre> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", as_magnitude<ratio(1, 3)>(), yard> {};
|
||||
struct dim_length : base_dimension<"length", metre> {};
|
||||
|
||||
struct second : named_unit<second, "s", si::prefix> {};
|
||||
struct hour : named_scaled_unit<hour, "h", no_prefix, as_magnitude<ratio(36, 1, 2)>(), second> {};
|
||||
struct second : named_unit<second, "s"> {};
|
||||
struct hour : named_scaled_unit<hour, "h", as_magnitude<ratio(36, 1, 2)>(), second> {};
|
||||
struct dim_time : base_dimension<"time", second> {};
|
||||
|
||||
struct kelvin : named_unit<kelvin, "K", no_prefix> {};
|
||||
struct kelvin : named_unit<kelvin, "K"> {};
|
||||
|
||||
#if !UNITS_COMP_MSVC
|
||||
static_assert([]<Prefix P>(P) {
|
||||
return !requires { typename prefixed_unit<struct kilokelvin, P, kelvin>; };
|
||||
return !requires { typename prefixed_unit<struct kilokilometre, P, kilometre>; };
|
||||
}(si::kilo{})); // no prefix allowed
|
||||
#endif
|
||||
|
||||
struct metre_per_second : unit<metre_per_second> {};
|
||||
struct metre_per_second : derived_unit<metre_per_second> {};
|
||||
struct dim_speed :
|
||||
derived_dimension<dim_speed, metre_per_second, units::exponent<dim_length, 1>, units::exponent<dim_time, -1>> {};
|
||||
struct kilometre_per_hour : derived_unit<kilometre_per_hour, dim_speed, kilometre, hour> {};
|
||||
struct kilometre_per_hour : derived_scaled_unit<kilometre_per_hour, dim_speed, kilometre, hour> {};
|
||||
|
||||
static_assert(equivalent<metre::named_unit, metre>);
|
||||
static_assert(equivalent<metre::scaled_unit, metre>);
|
||||
|
||||
Reference in New Issue
Block a user