Introduce ClosedComparableRange interface which inherits ClosedRange to provide special comparison operation for double and float.

This commit is contained in:
Ilya Gorbunov
2016-11-25 07:14:14 +03:00
parent 5773594412
commit d60fc7d9a8
6 changed files with 71 additions and 25 deletions
+2 -2
View File
@@ -17,5 +17,5 @@
package kotlin.ranges
@SinceKotlin("1.1")
public inline operator fun Float.rangeTo(that: Float): ClosedRange<Float> =
this.toDouble().rangeTo(that.toDouble()) as ClosedRange<Float>
public inline operator fun Float.rangeTo(that: Float): ClosedComparableRange<Float> =
this.toDouble().rangeTo(that.toDouble()).unsafeCast<ClosedComparableRange<Float>>()