Alfredo Braunstein <[EMAIL PROTECTED]> writes:

| +bool PosIterator::operator!=(PosIterator const & a) const
| +{
| +     return !operator==(a);
| +}
| +
| +
| +bool PosIterator::operator==(PosIterator const & a) const 
| +{
| +     
| +     PosIteratorItem const & pa = a.stack_.top();
| +     PosIteratorItem const & p = stack_.top();
| +     
| +     return (pa.pl == p.pl && pa.pit == p.pit &&
| +             (p.pit == p.pl->end() || pa.pos == p.pos));
| +}

Sorry for not noticing this ealier, but I think (if possible) they
should be free functions and not class functions.

Then they would look like this:

bool operator==(PosIterator const & lhs,
                PosIterator const & rhs)
{
        PosIteratorItem const & li = lhs.stack_.top();
        PosIteratorItem const & ri = rhs.stack_.top();

        return li.pl == ri.pl && li.pit == ri.pit &&
               (li.pit == li.pl->end() || li.pos == ri.pos);
}


bool operator!=(PosIterator const & lhs,
                PosIterator const & rhs)
{
        return !(lhs == rhs);
}

Make them friends of the PosIterator class if you have to. 
(Only operator== of course...)


And yes, I found this better.

-- 
        Lgb

Reply via email to