How to get Ponter/Reference semantics in Scala.
- by Lukasz Lew
In C++ I would just take a pointer (or reference) to arr[idx].
In Scala I find myself creating this class to emulate a pointer semantic.
class SetTo (val arr : Array[Double], val idx : Int) {
def apply (d : Double) { arr(idx) = d }
}
Isn't there a simpler way?
Doesn't Array class have a method to return some kind of reference to a particular field?