C++11: Cleaned up program framework with range-based for

This commit is contained in:
Paul Beckingham
2015-05-11 17:50:53 -04:00
parent 5a57dfd70d
commit e74c6963a9
28 changed files with 937 additions and 1221 deletions

View File

@@ -528,11 +528,8 @@ void Config::parse (const std::string& input, int nest /* = 1 */)
split (lines, input, "\n");
// Parse each line.
std::vector <std::string>::iterator it;
for (it = lines.begin (); it != lines.end (); ++it)
for (auto& line : lines)
{
std::string line = *it;
// Remove comments.
std::string::size_type pound = line.find ("#"); // no i18n
if (pound != std::string::npos)
@@ -714,9 +711,8 @@ void Config::set (const std::string& key, const std::string& value)
// Provide a vector of all configuration keys.
void Config::all (std::vector<std::string>& items) const
{
std::map <std::string, std::string>::const_iterator it;
for (it = this->begin (); it != this->end (); ++it)
items.push_back (it->first);
for (auto& it : *this)
items.push_back (it.first);
}
////////////////////////////////////////////////////////////////////////////////