Boost logo

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?


   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".


Eric Niebler
Boost Consulting

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at