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/nix-instantiate/nix-instantiate.cc | |
parent | 1511aa9f488ba0762c2da0bf8ab61b5fde47305d (diff) |
OCD: foreach -> C++11 ranged for
Diffstat (limited to 'src/nix-instantiate/nix-instantiate.cc')
-rw-r--r-- | src/nix-instantiate/nix-instantiate.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index bea04180e513..b6845197ec71 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -45,8 +45,8 @@ void processExpr(EvalState & state, const Strings & attrPaths, Value vRoot; state.eval(e, vRoot); - foreach (Strings::const_iterator, i, attrPaths) { - Value & v(*findAlongAttrPath(state, *i, autoArgs, vRoot)); + for (auto & i : attrPaths) { + Value & v(*findAlongAttrPath(state, i, autoArgs, vRoot)); state.forceValue(v); PathSet context; @@ -67,11 +67,11 @@ void processExpr(EvalState & state, const Strings & attrPaths, } else { DrvInfos drvs; getDerivations(state, v, "", autoArgs, drvs, false); - foreach (DrvInfos::iterator, i, drvs) { - Path drvPath = i->queryDrvPath(); + for (auto & i : drvs) { + Path drvPath = i.queryDrvPath(); /* What output do we want? */ - string outputName = i->queryOutputName(); + string outputName = i.queryOutputName(); if (outputName == "") throw Error(format("derivation ‘%1%’ lacks an ‘outputName’ attribute ") % drvPath); @@ -168,9 +168,9 @@ int main(int argc, char * * argv) if (attrPaths.empty()) attrPaths.push_back(""); if (findFile) { - foreach (Strings::iterator, i, files) { - Path p = state.findFile(*i); - if (p == "") throw Error(format("unable to find ‘%1%’") % *i); + for (auto & i : files) { + Path p = state.findFile(i); + if (p == "") throw Error(format("unable to find ‘%1%’") % i); std::cout << p << std::endl; } return; |