Boost logo

Boost :

Subject: Re: [boost] [foreach] use of boost_foreach_argument_dependent_lookup_hack
From: Tim Blechmann (tim_at_[hidden])
Date: 2015-07-15 08:31:46


>>> I'm rather conversative and prefer a pragma-free workaround: I don't
>>> know which exact compiler versions support push_macro etc.
>>
>> https://github.com/boostorg/foreach/pull/4/files
>
> Shouldn't you have
>
> # undef foreach
>
> after
>
> # pragma push_macro("foreach")
>
> ?

yes. i didn't pursue this further, since boost devs don't seem to care
about qt users and i don't want to waste my time to argue with dogmatic
people ...

>> [push_macro] is supported by msvc for ages and by gcc since 4.6
>> and clang ...
>
> As for GCC, we're still testing 4.4 (http://tinyurl.com/no2q5wh ). Besides,
> there are other compilers outside the three big ones, so I'm not so
> convinced about this patch.

of course this is not a general solution, but a pragmatic way to make
the codebase more robust, which works for most users.

> I think it's fair to declare Boost.Foreach unusable in the presence of
> "foreach" macros, and we should only strive to be resilient against
> these for libs that do not depend on Boost.Foreach (as is the case
> for Boost.MultiIndex, which merely ensures interoperability with it).
> So far, direct use of boost_foreach_argument_dependent_lookup_hack seems
> more robust.

it is possible to use boost.foreach and qt in the same codebase. though
in times of range-based for, its use is rather limited, anyway ... fwiw,
i've been using these pragmas successfully in a shared qt/boost codebase
...


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