I want to read a line from input and convert it to generic type. something like
fun <T> R() : T {
return readLine()!!.toType(T)
}
so for R<int>() it will call toInt() for long toLong() etc. how to achieve such a thing? And btw is there a possibility to have a default generic type (C++ has that) in case you want provide one