
13 Jun
2011
13 Jun
'11
12:11 p.m.
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.