Skip to content

Commit

Permalink
Update INIReader.cpp file
Browse files Browse the repository at this point in the history
update to compatible solution to replace std::map::at, which is not available until c++11
  • Loading branch information
jinstrong authored Jun 17, 2016
1 parent 159f278 commit 716cc04
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cpp/INIReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ 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;
//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;
// Use _values.find() here instead of _values.at() to support pre C++11 compilers
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 716cc04

Please sign in to comment.