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

min max #105

Closed
Deviaphan opened this issue Sep 25, 2020 · 3 comments
Closed

min max #105

Deviaphan opened this issue Sep 25, 2020 · 3 comments

Comments

@Deviaphan
Copy link

There are problems with old-style min-max C macros, need to supplement all definitions and calls with parentheses to compile. Eigen did this.

// Full specialization template <> struct TypeTraits<float> { static inline float **(**min**)**() { return **(**std::numeric_limits<float>::min**)**(); } };

@yixuan
Copy link
Owner

yixuan commented Jan 10, 2021

Thanks! Do I also need to to the same trick when I use std::min and std::max?

@Deviaphan
Copy link
Author

Do I also need to to the same trick when I use std::min and std::max?

Yes, better to enclose functions in parentheses that match standard macros. For "(std::min)(a,b)" it is also better to do this. And for templated and for simple functions.

@yixuan
Copy link
Owner

yixuan commented Jan 10, 2021

Thanks. I have done this in c81bcfe. Could you give a quick test? Note that I worked in the 1.y.z branch, which will be the next major release. It breaks a lot of APIs, so you may need to change your code accordingly. Also see the discussion here.

@yixuan yixuan closed this as completed Apr 4, 2021
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

2 participants