Commit 7f22ec06 authored by Davis King's avatar Davis King

Added order_by_descending_distance()

parent 2d034a58
...@@ -95,6 +95,15 @@ namespace dlib ...@@ -95,6 +95,15 @@ namespace dlib
return a.distance() < b.distance(); return a.distance() < b.distance();
} }
template <typename T>
inline bool order_by_descending_distance (
const T& a,
const T& b
)
{
return a.distance() > b.distance();
}
template <typename T> template <typename T>
bool order_by_distance_and_index ( bool order_by_distance_and_index (
const T& a, const T& a,
......
...@@ -114,6 +114,20 @@ namespace dlib ...@@ -114,6 +114,20 @@ namespace dlib
used with std::sort(). used with std::sort().
!*/ !*/
template <typename T>
bool order_by_descending_distance (
const T& a,
const T& b
) { return a.distance() > b.distance(); }
/*!
requires
- T is a type with an interface compatible with sample_pair.
ensures
- provides a total ordering of sample_pair objects that causes pairs with
largest distance to be the first in a sorted list. This function can be
used with std::sort().
!*/
template <typename T> template <typename T>
bool order_by_distance_and_index ( bool order_by_distance_and_index (
const T& a, const T& a,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment