Boost logo

Boost :

From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2008-05-24 17:55:01


Roland Schwarz wrote:
> The attached patch to iterator_facade made my "Readable" and
> "Writeable" == "Swapable" iterator work. However I am not
> practised enough to tell if this will break something else.
>
I believe this would break code where reference == value_type (not
unusual for input iterators), because the two conversion operators would
have the same target type. This could be solved with specialization.

It might also introduce ambiguities where reference == value_type&
(requirement for lvalue iterators). This should be pretty trivial to test.

void foo(const int &i);

int main()
{
  iterator_with_value_type_ref_as_reference r = get_that_iterator();
  foo(r[0]);
}

It should also be possible to solve via specialization - there's no need
for the conversion to value_type if reference == value_type&.

Sebastian


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