Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- implicit class X(str: String) {
- def toPositiveNumeric[T >: Int with Long with Float with Double <: AnyVal]
- (implicit ev: T => Ordered[T], ctag: ClassTag[T]): T = ???
- }
- Array(Array(Int.getClass, "123"), Array(Double.getClass, "123"))
- .foreach { case Array(tpe, str) =>
- assert(str.toPositiveNumeric[tpe] == 123.asInstanceOf[tpe])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement