Skip to content
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

Put the math functions in the same namespace as the units #433

Closed
BenFrantzDale opened this issue Feb 1, 2023 · 1 comment
Closed

Put the math functions in the same namespace as the units #433

BenFrantzDale opened this issue Feb 1, 2023 · 1 comment

Comments

@BenFrantzDale
Copy link

For types that are math-like, I am in the habit of putting operators like abs in the same namespace so they are found by ADL if I do the std::swap two-step as in

template <typename T>
[[nodiscard]] auto myGenericFunction(T x) {
    using std::abs;
    x = abs(x); // Finds std::abs for T == double, but finds abs by ADL otherwise.
    ...

Having them in ::units::math breaks that, and there's not really a solution in generic code.

@BenFrantzDale
Copy link
Author

I must have been mistaken. They are in the same namespace 🤦 https://github.com/mpusz/units/blob/master/src/core/include/units/math.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant