-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(core): replace wrapped_type_t
with std::indirectly_readable_traits
#625
Comments
That's a good catch! As |
You are welcome to provide PR with such a change. |
I also think we should use template<typename Rep>
constexpr bool treat_as_floating_point =
std::chrono::treat_as_floating_point_v<typename value_type<Rep>::type>;
template<typename Rep>
constexpr bool treat_as_floating_point =
std::chrono::treat_as_floating_point_v<Rep> ||
std::chrono::treat_as_floating_point_v<typename value_type<Rep>::type>; |
The same logic applies to template<typename Rep>
struct quantity_values : std::chrono::duration_values<Rep> {
static constexpr Rep one() noexcept
requires std::constructible_from<Rep, int>
{
return Rep(1);
}
}; There is a difference in that We can go a step further and make the |
Alternatively, if we wanted to use our own trait, we could use the chrono trait as the default implementation. This might be useful if we found some undesirable behavior in the chrono approach, and we wanted to depart from it. But I think we'd be able to switch to that approach later, in any case. |
Regarding |
Yeah, let's see what LEWG has to say, since the mentioned paper hasn't moved. |
Also, the other changes that you proposed seem uncontroversial, so we can implement them now without waiting for LEWG. |
Title: refactor(core): replace
wrapped_type_t
withstd::indirectly_readable_traits
.Description:
See https://wg21.link/readable.traits and
mp-units/src/core/include/mp-units/framework/customization_points.h
Lines 52 to 57 in 89bafed
wrapped_type_t
is defined atmp-units/src/core/include/mp-units/ext/type_traits.h
Lines 103 to 140 in 89bafed
It seems to me that we could replace the
treat_as_floating_point
primary and specialization withand
value_type
withto also:
const
correct, and::value_type
over::element_type
.The text was updated successfully, but these errors were encountered: