Fix for clash with Windows "min" and "max" macros #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greetings!
Due to Windows having "min" and "max" defined as macros a compile error occurs whenever Windows.h and svector.h headers are included together on that system.
It results in the following error:
...svector.h:137: error: C2589: '(': illegal token on right side of '::'
Here is the code to demonstrate the issue:
The changes proposed simpy add parentheses around statements with
std::min
andstd::max
. It appears to be the easiest and least intrusive solution, no need to do things like messing withNOMINMAX
macro, for instance.Further reading:
https://stackoverflow.com/questions/1394132/macro-and-member-function-conflict
https://learn.microsoft.com/en-us/windows/win32/multimedia/min
https://learn.microsoft.com/en-us/windows/win32/multimedia/max