From: Aristid Breitkreuz (aribrei_at_[hidden])
Date: 2006-10-24 17:56:34
too funny I recently implemented named parameters for macros, too. But
differently and specialised (no general-purpose framework or anything -
not because it were not doable, but because I didn't need it).
Nevertheless, they are used like this
MACRO((foo, 77) (bar, int))
which will expand to say
The idea is "simple":
1. Generate a valid PP-Sequence from this "tuple-sequence"-thing
2. Generate a set of "modifications" by looking up the value of PARAM_
## param (x), which will expand to (index, x) or something like this.
3. Apply those changes to an initial tuple.
4. Use the tuple to invoke another macro.
I do not know which approach should be considered superior. But I really
consider both interesting. I used my approach in a usable C++ library
already, so the concept (which is the same for both) _is_ practical.
PS: I do not think preprocessor metaprogramming should be over-used but
there are a few places where it fits nicely.
Am Dienstag, den 24.10.2006, 22:24 +0200 schrieb Tobias Schwinger:
> // ---- client code
> // expands to: yaba daba doo
> // expands to: 1st_default bubu 3rd_default.
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk