setup

fun setup(reset: (T) -> Unit = {}, preallocate: Int, gen: (Int) -> T)

Setup structure containing a set of reusable objects.

Parameters

reset

the function that reset an existing object to its initial state

preallocate

the number of objects to preallocate

gen

the object generate function to create a new object when needed