Boost logo

Boost :

Subject: Re: [boost] [Fusion] begin/end ADL issues with C++0x range-based for
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-12-21 00:18:31


On 12/21/2010 12:56 PM, Michel MORIN wrote:
> Michel MORIN wrote:
>> Better solutions would be:
>>
>> A. (almost the same as Jeffrey's suggestion)
>> If boost::fusion::begin/end doesn't need to be found via ADL,
>> then use ADL barrier technique to fusion::begin/end
>> (i.e. defining begin/end in another namespace and pull its name
>> in namespace fusion by using directive/declaration).
>>
>> B.
>> If boost::begin/end doesn't need to be found via ADL,
>> then use ADL barrier technique to boost::begin/end.
>>
>> C.
>> Define begin/end in namespace boost for all containers and ranges
>> which live in namespace boost (boost::array, boost::iterator_range,
>> boost::unordered_map, etc.).
>> For example, define begin/end for boost::array in namespace boost.
>> Since this is very tedious work, it would be better to define some
>> BOOST_DEFINE_BEGIN_END macro for boilerplate code generation.
>
> Oooops, I made a mistake!
> Definitely, solution B is not a choice.
> It diables Boost-interfaced range from using in range-based for.
>
> So let's forget about solution B.

A is the only viable option, AFAIK.

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net

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