Boost logo

Boost Users :

Subject: Re: [Boost-users] [preprocessor] removing parentheses
From: Edward Diener (eldiener_at_[hidden])
Date: 2010-08-05 07:15:17

On 8/4/2010 7:07 PM, John B. Turpish wrote:
> On Wed, Aug 4, 2010 at 4:05 PM, Edward Diener<eldiener_at_[hidden]> wrote:
>> I have a single macro parameter which allows its passed value to contain
>> commas. Therefore the user of the macro needs parentheses around the
>> parameter if it contains one or more commas ( to does not have to ). When
>> processing this parameter in a macro I would like to remove the outer
>> parentheses if they are there before passing the value on for further
>> processing. Is there a way to do this using some preprocessor library macro
>> ?
> Have you considered using a variadic macro? I hear they're not
> available for all C++ precompilers, but it may do what you want:
> Instead of
> you might use
> #define YOUR_MACRO( ... ) __VA_ARGS__
> I know it's only "one" argument you're after, but this would at least
> pull the commas through in-tact.

Variadic macros would indeed be a solution if the compiler(s) I am using
supported that feature. But I am really trying to do work for inclusion
into Boost itself and very few compilers support variadic macros as yet.

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