Skip to content

Commit

Permalink
Prepend details namesapce
Browse files Browse the repository at this point in the history
  • Loading branch information
nbresler committed Apr 18, 2024
1 parent 832cba8 commit 0346a4a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/core/include/mp-units/bits/external/type_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <string_view>
#endif

namespace mp_units::detail {

template<typename T>
[[nodiscard]] consteval std::string_view type_name()
{
Expand Down Expand Up @@ -40,3 +42,5 @@ template<typename T1, typename T2>
else
return v2;
}

} // namespace mp_units::detail
2 changes: 1 addition & 1 deletion src/core/include/mp-units/bits/magnitude.h
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ consteval bool less(MagnitudeSpec auto lhs, MagnitudeSpec auto rhs)
using rhs_base_t = decltype(get_base_value(rhs));

if constexpr (is_named_magnitude<lhs_base_t> && is_named_magnitude<rhs_base_t>)
return type_name<lhs_base_t>() < type_name<rhs_base_t>();
return detail::type_name<lhs_base_t>() < detail::type_name<rhs_base_t>();
else if constexpr (!is_named_magnitude<lhs_base_t> && !is_named_magnitude<rhs_base_t>)
return get_base_value(lhs) < get_base_value(rhs);
else
Expand Down
6 changes: 3 additions & 3 deletions src/core/include/mp-units/quantity_spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ template<auto... Args>
}

template<NamedQuantitySpec Lhs, NamedQuantitySpec Rhs>
struct quantity_spec_less : std::bool_constant<type_name<Lhs>() < type_name<Rhs>()> {};
struct quantity_spec_less : std::bool_constant<detail::type_name<Lhs>() < detail::type_name<Rhs>()> {};

template<typename T1, typename T2>
using type_list_of_quantity_spec_less = expr_less<T1, T2, quantity_spec_less>;
Expand Down Expand Up @@ -639,7 +639,7 @@ template<Dimension D1, Dimension D2>
else if constexpr (rhs == dimension_one)
return true;
else
return type_name<D1>() < type_name<D2>();
return detail::type_name<D1>() < detail::type_name<D2>();
}

template<QuantitySpec Lhs, QuantitySpec Rhs, bool lhs_eq = requires { Lhs::_equation_; },
Expand All @@ -649,7 +649,7 @@ struct ingredients_less :
std::bool_constant<(lhs_compl > rhs_compl) ||
(lhs_compl == rhs_compl && ingredients_dimension_less(Lhs::dimension, Rhs::dimension)) ||
(lhs_compl == rhs_compl && Lhs::dimension == Rhs::dimension &&
type_name<Lhs>() < type_name<Rhs>())> {};
detail::type_name<Lhs>() < detail::type_name<Rhs>())> {};

template<typename T1, typename T2>
using type_list_of_ingredients_less = expr_less<T1, T2, ingredients_less>;
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/mp-units/unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ template<Unit U1, Unit U2>
return u2;
else
// TODO Check if there is a better choice here
return better_type_name(u1, u2);
return detail::better_type_name(u1, u2);
} else {
constexpr auto canonical_lhs = get_canonical_unit(U1{});
constexpr auto canonical_rhs = get_canonical_unit(U2{});
Expand Down

0 comments on commit 0346a4a

Please sign in to comment.