Was trying to compile some code from this SO question and run into this error message cannot find class manifest for element type T
. Here is another snippet that shows the behavior:
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) }
I can see that new collection.mutable.GenericArray[T](2)
fixes the issue. Apparently providing a manifest is the other option... But what does "providing a manifest mean"?