Skip to content

(std::min)(x, y) #1271

Answered by derekmauro
matta asked this question in Q&A
Sep 4, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

We use (std::min)(a, b) in headers because Windows has macros named min and max. Our own build rules have /DNOMINMAX, but we can't guarantee that everyone #include-ing our headers also has /DNOMINMAX. Somehow the parenthesis is a workaround, although I don't know what parsing rule makes it work.

https://godbolt.org/z/M8Grc6xab

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@matta
Comment options

Answer selected by matta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants