view: add equal overload that takes a parameter

This commit is contained in:
Danny Robson 2019-11-26 07:49:34 +11:00
parent 595d062638
commit c254846ac2

View File

@ -792,6 +792,25 @@ namespace cruft {
///////////////////////////////////////////////////////////////////////////
template <
typename BeginA, typename EndA,
typename BeginB, typename EndB,
typename ComparatorT
>
decltype(auto)
equal (
view<BeginA,EndA> const &a,
view<BeginB,EndB> const &b,
ComparatorT &&cmp
) {
return std::equal (
std::begin (a), std::end (a),
std::begin (b), std::end (b),
std::forward<ComparatorT> (cmp)
);
}
//-------------------------------------------------------------------------
template <
typename BeginA, typename EndA,
typename BeginB, typename EndB
@ -799,8 +818,7 @@ namespace cruft {
constexpr bool
equal (const view<BeginA,EndA> &a, const view<BeginB,EndB> &b)
{
return a.size () == b.size () &&
std::equal (std::begin (a), std::end (a), std::begin (b));
return ::cruft::equal (a, b, std::equal_to<void> {});
}