view: add equal
overload that takes a parameter
This commit is contained in:
parent
595d062638
commit
c254846ac2
22
view.hpp
22
view.hpp
@ -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> {});
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user