summaryrefslogtreecommitdiff
path: root/boost/range/algorithm/equal.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/range/algorithm/equal.hpp')
-rw-r--r--boost/range/algorithm/equal.hpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/boost/range/algorithm/equal.hpp b/boost/range/algorithm/equal.hpp
index a3ebc294d8..4472bb19db 100644
--- a/boost/range/algorithm/equal.hpp
+++ b/boost/range/algorithm/equal.hpp
@@ -31,7 +31,7 @@ namespace boost
IteratorCategoryTag1,
IteratorCategoryTag2 )
{
- do
+ while (true)
{
// If we have reached the end of the left range then this is
// the end of the loop. They are equal if and only if we have
@@ -46,7 +46,12 @@ namespace boost
return false;
// continue looping if and only if the values are equal
- } while(*first1++ == *first2++);
+ if (*first1 != *first2)
+ break;
+
+ ++first1;
+ ++first2;
+ }
// Reaching this line in the algorithm indicates that a value
// inequality has been detected.
@@ -66,7 +71,7 @@ namespace boost
IteratorCategoryTag1,
IteratorCategoryTag2 )
{
- do
+ while (true)
{
// If we have reached the end of the left range then this is
// the end of the loop. They are equal if and only if we have
@@ -81,7 +86,12 @@ namespace boost
return false;
// continue looping if and only if the values are equal
- } while(pred(*first1++, *first2++));
+ if (!pred(*first1, *first2))
+ break;
+
+ ++first1;
+ ++first2;
+ }
// Reaching this line in the algorithm indicates that a value
// inequality has been detected.
@@ -182,7 +192,7 @@ namespace boost
}
} // namespace range
- using range::equal;
+ using ::boost::range::equal;
} // namespace boost
#endif // include guard