|
Boost Users : |
Subject: Re: [Boost-users] [preprocessor] Identity function for token concatenation
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-06-18 15:21:44
On Mon, Jun 18, 2012 at 10:35 AM, Jeremiah Willcock <jewillco_at_[hidden]>wrote:
> Boost.Preprocessor has a macro BOOST_PP_INTERCEPT to eat a numeric value
> that it is token-concatenated onto. Is there a similar macro that just
> returns the value? I.e., some BOOST_PP_EMPTY_FOR_CONCAT such that
> BOOST_PP_EMPTY_FOR_CONCAT ## 3 turns into 3? As with BOOST_PP_INTERCEPT,
> it only needs to work for small integer values. Is there some other
> technique I can use for this? I am using it to generate std::get<>
> invocations in BOOST_PP_ENUM_BINARY_PARAMS. Thank you for your help.
>
I don't know any such facility in Boost.PP, but it's pretty trivial to
generate:
#define X0 0
#define X1 1
#define X2 2
// etc.
...which makes me think I might be overlooking something in Boost.PP :/
Somewhat related: what do your ENUM_BINARY_PARAMS invocations look like? I
know I've gotten away with cat'ing template parameter delimiters ("<" and
">") against preprocessor integer tokens.
Probably not really helping,
- Jeff
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net