| 25 | class IteratorCategoryTag1, |
| 26 | class IteratorCategoryTag2 > |
| 27 | inline bool equal_impl( SinglePassTraversalReadableIterator1 first1, |
| 28 | SinglePassTraversalReadableIterator1 last1, |
| 29 | SinglePassTraversalReadableIterator2 first2, |
| 30 | SinglePassTraversalReadableIterator2 last2, |
| 31 | IteratorCategoryTag1, |
| 32 | IteratorCategoryTag2 ) |
| 33 | { |
| 34 | while (true) |
| 35 | { |
| 36 | // If we have reached the end of the left range then this is |
| 37 | // the end of the loop. They are equal if and only if we have |
| 38 | // simultaneously reached the end of the right range. |
| 39 | if (first1 == last1) |
| 40 | return first2 == last2; |
| 41 | |
| 42 | // If we have reached the end of the right range at this line |
| 43 | // it indicates that the right range is shorter than the left |
| 44 | // and hence the result is false. |
| 45 | if (first2 == last2) |
| 46 | return false; |
| 47 | |
| 48 | // continue looping if and only if the values are equal |
| 49 | if (*first1 != *first2) |
| 50 | break; |
| 51 | |
| 52 | ++first1; |
| 53 | ++first2; |
| 54 | } |
| 55 | |
| 56 | // Reaching this line in the algorithm indicates that a value |
| 57 | // inequality has been detected. |
| 58 | return false; |
| 59 | } |
| 60 | |
| 61 | template< class SinglePassTraversalReadableIterator1, |
| 62 | class SinglePassTraversalReadableIterator2, |