From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-05-18 08:59:17


David Abrahams wrote:

> "Neal D. Becker" <ndbecker2_at_[hidden]> writes:
>
>> David Abrahams wrote:
>>
>>> "Neal D. Becker" <ndbecker2_at_[hidden]> writes:
>>>
>>>> Max Khesin wrote:
>>>>
>>>>>
>>>>>> "Neal D. Becker" <ndbecker2_at_[hidden]> writes:
>>>>>
>>>>> Good suggestion! I'll post the modified code if anyone is interested.
>>>>>
>>>>>
>>>>>
>>>>> Yes pleaze.
>>>>
>>>> Here is the current version:
>>>
>>> distance_to doesn't belong here, and you can eliminate the
>>> corresponding cnt.
>>>
>>
>> Actually, I like the one based on Vladimir Prus much better than the one
>> I wrote, so here is the current:
>
> I don't love it. Count is overkill; you only need a bool. Also it
> only works when value_type is default-constructible. There's a
> reason I suggested optional<value_type>, you know ;-)
>

OK, this one looks good. increment now will invalidate cache, so this one
will call the underlying function the exact correct number of times.

Any comments?