diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-03-15 10:44:27 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-03-15 10:44:27 +0000 |
commit | 2ccf6d3b00d34176e100dd1b87f70182e79d5b93 (patch) | |
tree | f6d6a3d36c91114ae3d98f841f71745591c572a4 /src | |
parent | cc1a2efec3c0826703a819df4f5856c68a0caea4 (diff) | |
download | scala-2ccf6d3b00d34176e100dd1b87f70182e79d5b93.tar.gz scala-2ccf6d3b00d34176e100dd1b87f70182e79d5b93.tar.bz2 scala-2ccf6d3b00d34176e100dd1b87f70182e79d5b93.zip |
Fixes #3155. No review is necessary.
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/math/Ordering.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/library/scala/math/Ordering.scala b/src/library/scala/math/Ordering.scala index 1660cdb99e..04c2d96aba 100644 --- a/src/library/scala/math/Ordering.scala +++ b/src/library/scala/math/Ordering.scala @@ -133,6 +133,8 @@ object Ordering extends LowPriorityOrderingImplicits { override def lteq(x: T, y: T): Boolean = !cmp(y, x) } + def by[T, S: Ordering](f: T => S): Ordering[T] = fromLessThan((x, y) => implicitly[Ordering[S]].lt(f(x), f(y))) + trait UnitOrdering extends Ordering[Unit] { def compare(x: Unit, y: Unit) = 0 } |