Take a look on my code and tell me how to do this proper way. First of all this is part of my config manager class. Generally i want to use read function only with three main types of data int, float, string (maybe bool in futhure).
template<typename T>
T Read(const std::string& name)
{
T retVal;
std::string buffer;
while(std::getline(m_hFile, buffer))
{
if(strstr(buffer.c_str(), name.c_str()))
{
std::smatch match;
const std::regex regex_patern("=\"(.*)\"");
std::regex_search(buffer, match, regex_patern);
retVal = ????
break;
}
}
return retVal;
}
How can i cast this std::smatch to get it work? What should i do there? I dont really have idea. Any tips or code snippets are welcome.
Aucun commentaire:
Enregistrer un commentaire