|
Boost Users : |
From: Eric Niebler (eric_at_[hidden])
Date: 2005-01-20 02:30:08
cheesy4poofs wrote:
> I looked thru some boost headers and noticed some code
> like: (std:min)(x, y)
>
> On a whim, I added this to my code and BINGO, everything compiles fine. I
> am curious why this fixed it though? Is it because the preprocessor mangled
> the "min" before the compiler saw it?
Yup.
And the parenthesis, in effect,
> prevent the preprocessor from expanding the macro?
>
Yup. Function-like macros are only applied when the name of the macro is
immediately followed by (optional whitespace and) an opening paren. When
you say (std::min)(x, y), the min macro cannot apply because of the
closing paren after "min".
HTH,
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net