-
Notifications
You must be signed in to change notification settings - Fork 23
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
Comfortable ceil function #385
Comments
Unfortunately, I think you're running into the exact reasons why we didn't provide a bare The principle at work here is that a
Something like In your example above, you should be able to write auto result = ceil_as<double>(microliters, mL1 * p); But if you wanted to write out the full typename, and avoid repeating the unit, then I think you'd be out of luck: the right-hand side (RHS) gets computed without any knowledge of the left-hand side (LHS) it's getting assigned to, so there's no way to get the information from the type in the LHS to affect the computation in the RHS. Please let me know if you have any further questions here! |
Also, as a quick aside:
On the implementation side for this function, I would suggest the following changes: template <typename U, typename R>
auto ceil(au::Quantity<U, R> q)
{
return ceil_as(U{}, q);
} That is:
|
Thanks for your reply. I will read the documentation in more detail in the next days. |
Hi,
I would like to have a comfortable ceil function. This has also the advantage that ADL can be used.
Something like this:
This works in most cases, but not when I have a product with
au::Percent
:My question is, can I somehow prevent such an unexpected result and still have a comportable function like
ceil()
?The text was updated successfully, but these errors were encountered: