// // equal.h // stream // // Created by Sam Jaffe on 4/2/23. // #pragma once #include namespace stream::range { template > bool equal(It1 it1, S1 end1, It2 it2, S2 end2, Cmp cmp = {}) { for (; it1 != end1 && it2 != end2; ++it1, ++it2) { if (!std::invoke(cmp, *it1, *it2)) { return false; } } return (it1 != end1) == (it2 != end2); } template > bool equal(S1 const s1, S2 const & s2, Cmp cmp = {}) { return equal(s1.begin(), s1.end(), s2.begin(), s2.end(), cmp); } }