C++らしく書こう

#include <fstream>
#include <sstream>
#include <string>

template<typename T>
void get_value(std::ifstream &file, T &value){
std::string line;
if(std::getline(file, line)) std::istringstream(line) >> value;
}

int main(){
int A;
int B;
double C;

if(std::ifstream file = std::ifstream("setting.ini")){
get_value(file, A);
get_value(file, B);
get_value(file, C);
}
}