Boost logo

Boost :

Subject: Re: [boost] [foreach][assign] Does foreach work with assign::list_of?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-06-13 08:11:03


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.


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