Boost logo

Boost :

Subject: Re: [boost] [foreach][assign] Does foreach work with assign::list_of?
From: Eric Niebler (eric_at_[hidden])
Date: 2011-06-14 00:55:14


On 6/13/2011 7:11 PM, Mathias Gaunard wrote:
> On 13/06/2011 09:56, Michel MORIN wrote:
>
>> The problem is that `generic_list<T>` (a return value of
>> `assign::list_of()`)
>> has very generic conversion operator:
>> template<class Container> operator Container() const;
>>
>> This generic conversion operator leads to the compiler error;
>> Containers used with `BOOST_FOREACH` should not be convertible to
>> `rvalue_probe`. In the above case, `generic_list<T>` is convertible to
>> `rvalue_probe< generic_list<T> >` and the compiler error happens.
>>
>> If SFINAE could be used with conversion operators, we could selectively
>> disable problematic conversions. Unfortunately, we cannot apply SFINAE
>> to conversion operators in C++03.
>
> Or BOOST_FOREACH could be changed to work differently.

Sure. Just tell me how else to detect const rvalues in standard C++98.

Eagerly-awaiting-your-reply-ly,

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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