refactor: 💥 ! U::is_named removed from the unit types and replaced with NamedUnit concept
This commit is contained in:
1 parent
0522bae972
commit
725d193122
4 files changed
+41
-19
No files matched your search
@@ -96,9 +96,18 @@ void to_base_scaled_unit(const volatile scaled_unit<R, U>*);
|
||||
template<typename T>
|
||||
concept Unit = requires(T* t) { detail::to_base_scaled_unit(t); };
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename>
|
||||
inline constexpr bool is_named = false;
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
concept NamedUnit = Unit<T> && detail::is_named<T>;
|
||||
|
||||
// BaseDimension
|
||||
template<basic_fixed_string Symbol, Unit U>
|
||||
requires U::is_named
|
||||
template<basic_fixed_string Symbol, NamedUnit U>
|
||||
struct base_dimension;
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -110,7 +110,7 @@ template<Exponent Exp>
|
||||
constexpr auto exponent_list_with_named_units(Exp)
|
||||
{
|
||||
using dim = TYPENAME Exp::dimension;
|
||||
if constexpr (dimension_unit<dim>::is_named) {
|
||||
if constexpr (NamedUnit<dimension_unit<dim>>) {
|
||||
return exponent_list<Exp>();
|
||||
} else {
|
||||
using recipe = TYPENAME dim::recipe;
|
||||
|
||||
Reference in new issue
Block a user