Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2003-04-11 15:51:05


Aleksey Gurtovoy wrote:
> Is there a way to detect a particular pre-defined token passed as a
> parameter to a macro? If yes, can we fold it into a PP-library
> primitive so one can reuse it easily?
>
> For instance, I would like to be able to allow both this:
>
> MY_MACRO(10, MY_OTHER_MACRO)
>
> and this:
>
> MY_MACRO(10, default) // use the "default parameter"
>
> Is there a known way to implement it?

It depends. There isn't a completely general way of doing this without
"token-pasting unrelated-tokens" being well-defined. However, it can be done if
you formalize it as a set of conventions.

First, though, I want to make sure I understand exactly what you mean. Do you
want everything to automatically pick up the default value(s)? Or do you just
want a way to signal "use default" to the implementation of the macro in
question, such as "MY_MACRO" above?

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