int w = config["width"];int h = config["height"];SetVideo(w, h);
Or you could (again, unless I'm smoking something) make the operator[] take a second dummy parameter of the required type, like this:
template<class T> const T& Config::operator[] (const string &name, T dummy) { std::string result = mReader[name]; if(result.empty()) return StringTo<T>(mDefaults[name]); return StringTo<T>(result);}// The "int(0)"s here should provide anonymous, auto storage ints.// But I'm not sure you can really do that...SetVideo(config["width", int(0)], config["height", int(0)]);
Or you could cause the Config class to maintain the association between key names and types... although I can't think of a way to do that without RTTI :s