Skip to content

Commit

Permalink
Support different types in algo_pred_equal and algo_pred_less
Browse files Browse the repository at this point in the history
  • Loading branch information
igaztanaga committed Jul 15, 2024
1 parent d9eddd7 commit 0baa42f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions include/boost/intrusive/detail/algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ namespace intrusive {

struct algo_pred_equal
{
template<class T>
bool operator()(const T &x, const T &y) const
template<class T, class T2>
bool operator()(const T &x, const T2 &y) const
{ return x == y; }
};

struct algo_pred_less
{
template<class T>
bool operator()(const T &x, const T &y) const
template<class T, class T2>
bool operator()(const T &x, const T2 &y) const
{ return x < y; }
};

Expand All @@ -49,10 +49,6 @@ bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, BinaryPredicat
return true;
}

template<class InputIt1, class InputIt2>
bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2)
{ return (algo_equal)(first1, last1, first2, algo_pred_equal()); }

template<class InputIt1, class InputIt2, class BinaryPredicate>
bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, BinaryPredicate pred)
{
Expand All @@ -62,6 +58,10 @@ bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2
return first1 == last1 && first2 == last2;
}

template<class InputIt1, class InputIt2>
bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2)
{ return (algo_equal)(first1, last1, first2, algo_pred_equal()); }

template<class InputIt1, class InputIt2>
bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2)
{ return (algo_equal)(first1, last1, first2, last2, algo_pred_equal()); }
Expand Down

0 comments on commit 0baa42f

Please sign in to comment.