You could modify ReadValues
a little to return the 2 double
s as a pair
.
auto ReadValues(const char filename[]) -> std::pair<double, double>
{
double sig, tau; // local variable instead of reference parameters
// read from file into sig and tau
return {sig, tau};
}
and now you can make your variables const
like this.
auto const [S, T] = ReadValues("myfile.txt");
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…