Used library comparison functions to compare pointers

This commit is contained in:
Krystian Stasiowski
2020-02-01 15:22:50 -05:00
parent c3ea8a976d
commit ad4a2f191b
3 changed files with 41 additions and 146 deletions
@@ -574,7 +574,8 @@ find_first_of(
return last;
}
// Check if a pointer lies within a range without unspecified behavior, allowing it to be used in a constant evaluation
// Check if a pointer lies within a range (inclusive) without unspecified behavior,
// allowing it to be used in a constant evaluation
template<typename T>
BOOST_STATIC_STRING_CPP14_CONSTEXPR
inline
@@ -584,10 +585,7 @@ is_inside(
const T* src_last,
const T* ptr)
{
for (; src_first != src_last; ++src_first)
if (src_first == ptr)
return true;
return false;
return std::greater_equal<void>()(ptr, src_first) && std::less_equal<void>()(ptr, src_last);
}
} // detail