base_dimension more constrained and comparison fixed

This commit is contained in:
Mateusz Pusz
2019-12-14 21:12:17 +01:00
parent 8d1eb4c415
commit 5ef0bb9a9f
2 changed files with 4 additions and 1 deletions

View File

@@ -48,6 +48,7 @@ namespace units {
* @tparam U a base unit to be used for this base dimension
*/
template<basic_fixed_string Name, Unit U>
requires U::is_named
struct base_dimension {
using base_type_workaround = base_dimension; // TODO Replace with is_derived_from_instantiation when fixed
static constexpr auto name = Name;
@@ -58,7 +59,8 @@ struct base_dimension {
// TODO Remove the below when https://bugs.llvm.org/show_bug.cgi?id=32208 is fixed
// clang-format off
template<BaseDimension D1, BaseDimension D2>
struct base_dimension_less : std::bool_constant<D1::name < D2::name> {};
struct base_dimension_less : std::bool_constant<
D1::name < D2::name || (D1::name == D2::name && D1::base_unit::symbol < D1::base_unit::symbol)> {};
// clang-format on
} // namespace units

View File

@@ -90,6 +90,7 @@ concept Unit = is_derived_from_instantiation<T, scaled_unit>;
// BaseDimension
template<basic_fixed_string Name, Unit U>
requires U::is_named
struct base_dimension;
namespace detail {