Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-08-26 08:11:13


Hi all,

I am trying to find a way to implement something like a preprocessing-time
map. As far as I understand, the task is trivial if "keys" contain only one
token:

#define FIND(x) BOOST_PP_CAT(FIND_, x)

#define FIND_key1 val1
#define FIND_key2 val2
#define FIND_key3 val3

And then:

FIND(key1) // evaluates to val1
FIND(key2) // evaluates to val2
FIND(key3) // evaluates to val3

However, this approach obviously brakes when keys contain more than one
token, like "key 1" (or, to be closer to the real problem, "unsigned int").

So I am wonderring if there is any facility in the preprocessor (or in the
Boost.Preprocessor) that would allow me to do this.

Thanks in advance,

Arkadiy


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