Skip to content

Commit

Permalink
Update INIReader.cpp file
Browse files Browse the repository at this point in the history
added an validated solution to replace std::map::at method, which is not available until c++11.
  • Loading branch information
jinstrong authored Jun 15, 2016
1 parent 0c3f8ea commit 159f278
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cpp/INIReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ int INIReader::ParseError() const
string INIReader::Get(string section, string name, string default_value) const
{
string key = MakeKey(section, name);
return _values.count(key) ? _values.at(key) : default_value;
return _values.count(key) ? _values.at(key) : default_value;
//Above statement used std::map::at method, which is not availalbe until c++11. Modify above sentence to below if using an older version of compiler:
//return _values.count(key) ? _values.find(key)->second : default_value;
}

long INIReader::GetInteger(string section, string name, long default_value) const
Expand Down

0 comments on commit 159f278

Please sign in to comment.