feat: kind_of_qs[unit] now returns a bare unit as a reference

This commit is contained in:
Mateusz Pusz
2023-08-18 11:01:40 +02:00
parent a3cf3f4087
commit ef39b8c4c7
2 changed files with 19 additions and 3 deletions
+7
View File
@@ -105,6 +105,13 @@ inline constexpr struct kilometre_ : decltype(si::kilo<metre>) {} kilometre;
inline constexpr struct bit_ : named_unit<"bit", one, kind_of<storage_capacity>> {} bit;
// clang-format on
static_assert(is_of_type<length[metre], reference<length, metre>>);
static_assert(is_of_type<kind_of<length>[metre], metre_>);
static_assert(is_of_type<(length / time)[metre / second], reference<length / time, metre / second>>);
static_assert(is_of_type<(kind_of<length> / kind_of<time>)[metre / second], derived_unit<metre_, per<second_>>>);
// Unit as a reference
static_assert(is_of_type<42 * metre, quantity<metre, int>>);
static_assert(quantity<metre, int>::quantity_spec == length);