vector finish
This commit is contained in:
36
headers/equal.hpp
Normal file
36
headers/equal.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user