|
Boost : |
Subject: Re: [boost] nested BOOST_FOREACH and -Wshadow
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-02-07 17:01:09
David Abrahams wrote:
> on Sat Feb 07 2009, Sebastian Redl <sebastian.redl-AT-getdesigned.at> wrote:
>
> F> John Bytheway wrote:
>>> I'd suggest a simpler (from the user perspective) solution would be to
>>> have BOOST_FOREACH paste __LINE__ into its variable names. Then the
>>> problem would only occur if nested BOOST_FOREACHs were used on the same
>>> line. Asking users not to do that seems a lot more reasonable than
>>> asking them not to use -Wshadow or not to use nested BOOST_FOREACHs at all.
>>>
>> I'm pretty sure you'd need a special variant for MS compilers, since
>> their __LINE__ expansion is not cleanly pasteable. (You can use their
>> counting macro instead.)
>
> Doesn't using BOOST_PP_CAT work?
Hmm, just tried and it works on VC9. It surely didn't on VC7.1.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk