-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathequal.hpp
More file actions
38 lines (34 loc) · 1.55 KB
/
equal.hpp
File metadata and controls
38 lines (34 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* equal.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: majermou <majermou@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 17:11:55 by majermou #+# #+# */
/* Updated: 2021/10/19 14:44:34 by majermou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef EQUAL_HPP
#define EQUAL_HPP
template <typename InputIterator1, typename InputIterator2>
bool equal(InputIterator1 first1,InputIterator1 last1,InputIterator2 first2) {
while (first1!=last1) {
if (!(*first1 == *first2))
return false;
++first1;
++first2;
}
return true;
}
template <typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
bool equal(InputIterator1 first1,InputIterator1 last1,InputIterator2 first2,BinaryPredicate pred) {
while (first1!=last1) {
if (!(pred(*first1,*first2)))
return false;
++first1;
++first2;
}
return true;
}
#endif // EQUAL_HPP