Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. implicit class X(str: String) {
  2. def toPositiveNumeric[T >: Int with Long with Float with Double <: AnyVal]
  3. (implicit ev: T => Ordered[T], ctag: ClassTag[T]): T = ???
  4. }
  5.  
  6. Array(Array(Int.getClass, "123"), Array(Double.getClass, "123"))
  7. .foreach { case Array(tpe, str) =>
  8. assert(str.toPositiveNumeric[tpe] == 123.asInstanceOf[tpe])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement