试图从中编译一些代码
this SO question
cannot find class manifest for element type T
. 下面是另一个显示行为的片段:
scala> def f[T](a:T, b:T):Array[T] = { new Array[T](2) }
<console>:4: error: cannot find class manifest for element type T
def f[T](a:T, b:T):Array[T] = { new Array[T](2) }
我看得出来
new collection.mutable.GenericArray[T](2)
解决了这个问题。显然地