Open velvia opened 6 years ago
I actually have a wip branch (10-as-array) which improves Array support for newtypes. At this point though, you should be fine to cast so long as you know that the types are correct. So the following may be a workaround for you -
Array[Long](10).asInstanceOf[Array[VectorPointer]]
You could wrap this into a method to improve safety -
@newsubtype case class VectorPointer(addr: Long)
object VectorPointer {
def wrapArray(a: Array[Long]): Array[VectorPointer] = a.asInstanceOf[Array[VectorPointer]]
def unwrapArray(a: Array[VectorPointer]): Array[Long] = a.asInstanceOf[Array[Long]]
}
scala> VectorPointer.wrapArray(Array(10))
res0: Array[VectorPointer] = Array(10)
version 0.4.2.