ifstream
offers an overload of operator>>
to extract values from the next line of the stream. However, I tend to find myself doing this often:
int index;
input >> index;
arr[index] = <something>;
Is there any way to get this data into the [index]
without having to create this temporary variable?