diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-17T17·24+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-17T18·13+0200 |
commit | 6bd2c7bb386de16310fa5534275e6e638be60862 (patch) | |
tree | 0a12144dfb4e8d1b069bc09d583b522b5c158b28 /src/libstore/globals.cc | |
parent | 1511aa9f488ba0762c2da0bf8ab61b5fde47305d (diff) |
OCD: foreach -> C++11 ranged for
Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r-- | src/libstore/globals.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index 50374f782dee..73f8489438fc 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -248,12 +248,12 @@ template<class N> void Settings::_get(N & res, const string & name) string Settings::pack() { string s; - foreach (SettingsMap::iterator, i, settings) { - if (i->first.find('\n') != string::npos || - i->first.find('=') != string::npos || - i->second.find('\n') != string::npos) + for (auto & i : settings) { + if (i.first.find('\n') != string::npos || + i.first.find('=') != string::npos || + i.second.find('\n') != string::npos) throw Error("illegal option name/value"); - s += i->first; s += '='; s += i->second; s += '\n'; + s += i.first; s += '='; s += i.second; s += '\n'; } return s; } @@ -261,11 +261,11 @@ string Settings::pack() void Settings::unpack(const string & pack) { Strings lines = tokenizeString<Strings>(pack, "\n"); - foreach (Strings::iterator, i, lines) { - string::size_type eq = i->find('='); + for (auto & i : lines) { + string::size_type eq = i.find('='); if (eq == string::npos) throw Error("illegal option name/value"); - set(i->substr(0, eq), i->substr(eq + 1)); + set(i.substr(0, eq), i.substr(eq + 1)); } } |