Nir
12/18/2020, 7:30 PMNikky
12/18/2020, 9:11 PMD
but the specific of the instance of D
used to construct a point are thrown away and only the dimension
attribute is kept
with reified
you can get the type that was used, but still won't get you the DimThree
object
i currently see no way around restructuring this or storing the dimension.. or at the least D::dimension
from what i can tell the length of data
is always D::dimension
and everything should be fine as long as that matches.. maybe that is good enough ?Nir
12/18/2020, 10:02 PMdata class Point<D : Dimension> private constructor(val data: List<Int>) {
constructor(d: D, init: (Int) -> Int) : this(List(d.dimension, init))
operator fun <D : Dimension> plus(p: Point<D>) = Point<D>(data.zip(p.data) { x, y -> x + y } )
}