Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-19 15:03:32


Stefan Slapeta <stefan_nospam__at_[hidden]> writes:

> David Abrahams wrote:
>
>> No it does not, but it may cost you an extra bool in your iterator
>> class.
>>
>
> Not necessary. Could anybody comment this fix (...and apply it if it's
> ok)? Tests are fine.

I don't know what the original code is and I don't want to have to
try to piece them together, so it would help if you'd just post what
you believe to be a conforming iterator. That said...

> BTW, the replace test doesn't compile at all with VC7.1+STLPort. I'll
> have a look on that later.
>
> Stefan
>
>
> --- find_iterator.hpp 15 Jul 2004 21:48:25 -0000 1.8
> +++ find_iterator.hpp 19 Jul 2004 14:41:19 -0000
> @@ -136,14 +136,10 @@
> // comparison
> bool equal( const find_iterator& Other ) const
> {
> - return
> + return eof() || Other.eof() ? eof() == Other.eof()
> :
> (
> m_Match==Other.m_Match &&
> m_End==Other.m_End
> - )
> - ||
> - (
> - eof() && Other.eof()
> );

This appears to be a complicated way to write:

   return eof() && Other.eof()
          || m_Match==Other.m_Match && m_End==Other.m_End;

Somehow that seems unlikely to be correct. Are m_Match and m_End
valid when eof() is true?

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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