I'm trying to write an access method for a class in D that I want to work for both mutable and immutable instances.
public immutable(double[]) getInputs(uint i)immutable{
return this.data[i];
}
public double[] getInputs(uint i){
return this.data[i];
}
I keep getting compiler errors unless I make both these versions that do (almost) the exact same thing.
Since I'm not changing any state, is there any way to use a single method that operates both on mutable and immutable instances?