Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-05-12 17:52:44

Joel de Guzman <joel_at_[hidden]> writes:

> Tobias Schwinger wrote:
>> Joel de Guzman wrote:
>>> Tobias Schwinger wrote:
>> 5. BTW...
>> I found it surprising that "iter->second" didn't work in place of "(*iter).second"
>> (see lines 456, 485)...
> This is tough. operator-> is required to be a member function.
> Unfortunately, that would also mean that the type dereferenced
> should also be known at compile time. This will ultimately break
> the MPL requirement that an iterator pointing at the *end* should
> not be dereferenced-- that's what will happen by the very act of
> computing the operator->'s return type.

I don't buy that argument. The past-the-end-iterator has a different
type from all the others, and since it's not dereferenceable anyway,
it doesn't need to have an operator->. Furthermore,

> Unfortunately for Fusion iterators, I can't find a suitable workaround
> to enable operator-> return type deduction only when appropriate. In
> general, an iterator does not know if it is at the end.

That part seems strange to me. It certainly could know whether it's
at the end, I think.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at