coord/comparator: allow delayed and defaulted deduction of arguments
This commit is contained in:
parent
6d48e5a8e5
commit
347b13ee60
@ -15,6 +15,11 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace cruft::coord {
|
||||
/// A StrictWeakOrder over coordinate types.
|
||||
template <typename CoordT = void>
|
||||
struct ordering;
|
||||
|
||||
|
||||
/// A StrictWeakOrder over coordinate types.
|
||||
///
|
||||
/// The comparison operates across successive elements of the two
|
||||
@ -35,4 +40,18 @@ namespace cruft::coord {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// A StrictWeakOrder over coordinate types.
|
||||
///
|
||||
/// Deduction is deferred until the function is called, in the same way
|
||||
/// that std::less<> operates.
|
||||
template <>
|
||||
struct ordering<void> {
|
||||
template <typename CoordT>
|
||||
bool operator() (CoordT const &a, CoordT const &b) const noexcept
|
||||
{
|
||||
return ordering<CoordT> {} (a, b);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user