diff options
author | David Robillard <d@drobilla.net> | 2012-12-25 00:51:18 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-12-25 00:51:18 +0000 |
commit | 12314c754187ae246bc38aceb827bf51d1669d73 (patch) | |
tree | 920e8855c6e933a8da19c6402b27e9b52ac3a474 /src/resp.cpp | |
parent | bf757dcc9b66ebb3bf7e2df8e8c7d3a011ddd6dc (diff) | |
download | resp-12314c754187ae246bc38aceb827bf51d1669d73.tar.gz resp-12314c754187ae246bc38aceb827bf51d1669d73.tar.bz2 resp-12314c754187ae246bc38aceb827bf51d1669d73.zip |
Use C++11 range-based for loops.
git-svn-id: http://svn.drobilla.net/resp/trunk@444 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/resp.cpp')
-rw-r--r-- | src/resp.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/resp.cpp b/src/resp.cpp index c37fd3d..704c864 100644 --- a/src/resp.cpp +++ b/src/resp.cpp @@ -157,11 +157,11 @@ main(int argc, char** argv) fs.open(output.c_str()); ostream& os = (output == "") ? std::cout : fs; - for (Files::iterator f = files.begin(); f != files.end(); ++f) { - ifstream is(*f); + for (auto f : files) { + ifstream is(f); try { while (is.good() && !is.eof()) { - Cursor loc(*f, 1, 1); + Cursor loc(f, 1, 1); const AST* exp = cenv->penv.parse(loc, is); if (!exp || (exp->to_tuple() && exp->to_tuple()->empty())) break; @@ -193,17 +193,16 @@ main(int argc, char** argv) ret = repl(*cenv); } else { // Evalute (or just type check if -T, or just compile if -S all files - for (Files::iterator f = files.begin(); f != files.end(); ++f) { - const string filename = *f; + for (std::string filename : files) { if (!batch) output = filename + ".out"; - ifstream is(*f); + ifstream is(filename); if (is.good()) { Cursor cursor(filename, 1, 1); ret = ret | eval(*cenv, cursor, is, !batch); } else { - cerr << argv[0] << ": " << *f << ": " << strerror(errno) << endl; + cerr << argv[0] << ": " << filename << ": " << strerror(errno) << endl; ++ret; } is.close(); |