37 lines
581 B
C++
37 lines
581 B
C++
|
|
#ifndef EQUAL_HPP
|
|
# define EQUAL_HPP
|
|
|
|
namespace ft {
|
|
|
|
template < typename InputIt1, typename InputIt2 >
|
|
bool equal( InputIt1 first1, InputIt1 last1, InputIt2 first2) {
|
|
|
|
while (first1 != last1)
|
|
{
|
|
if (!(*first1 == *first2))
|
|
return false;
|
|
++first1;
|
|
++first2;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
template < class InputIt1, class InputIt2, class BinaryPred >
|
|
bool equal( InputIt1 first1, InputIt1 last1, InputIt2 first2, BinaryPred pred) {
|
|
|
|
while (first1 != last1)
|
|
{
|
|
if (!pred(*first1, *first2))
|
|
return false;
|
|
++first1;
|
|
++first2;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
} // namespace ft
|
|
|
|
#endif
|
|
|