Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2004-03-25 19:31:21


> [mailto:boost-bounces_at_[hidden]] On Behalf Of Eric Niebler

> using std::min;
> min BOOST_PREVENT_MACRO_SUBSTITUTION ( a, b );
>
> I have 2 questions:
> 1) Is this the best name for the macro? Perhaps people would
> prefer something shorter. I'm open to suggestions.

You can always use BOOST_PP_EMPTY.

using std::min;
min BOOST_PP_EMPTY()(a, b);

I'll point out again that you have to be careful with either of the above
methods if they are ever used as an argument to a macro. This causes more than
one scan of the pp-tokens, which will allow min and max to expand as macros if
they are macros:

#define EXPAND(x) x

EXPAND( min BOOST_PP_EMPTY()(a, b); )

On a reasonably conformant preprocessor, the above or similar will still expand
min if it is a macro.

Regards,
Paul Mensonides


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk