
20 Jan
2005
20 Jan
'05
7:30 a.m.
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