Skip to content

Commit 9bf4c92

Browse files
committed
Fix inverted order of operands in op<=> implementations.
Fixes #79.
1 parent e608736 commit 9bf4c92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/boost/stl_interfaces/iterator_interface.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ namespace boost { namespace stl_interfaces { BOOST_STL_INTERFACES_NAMESPACE_V2 {
858858
return access::base(lhs) <=> access::base(rhs);
859859
} else {
860860
using diff_type = typename D1::difference_type;
861-
diff_type const diff = rhs - lhs;
861+
diff_type const diff = lhs - rhs;
862862
return diff < diff_type(0) ? std::strong_ordering::less :
863863
diff_type(0) < diff ? std::strong_ordering::greater :
864864
std::strong_ordering::equal;
@@ -1052,7 +1052,7 @@ namespace boost { namespace stl_interfaces { BOOST_STL_INTERFACES_NAMESPACE_V3 {
10521052
return access::base(lhs) <=> access::base(rhs);
10531053
} else {
10541054
using diff_type = typename D1::difference_type;
1055-
diff_type const diff = rhs - lhs;
1055+
diff_type const diff = lhs - rhs;
10561056
return diff < diff_type(0) ? std::strong_ordering::less :
10571057
diff_type(0) < diff ? std::strong_ordering::greater :
10581058
std::strong_ordering::equal;

0 commit comments

Comments
 (0)