Issue510

Title task class: iterate over collections
Priority feature Status resolved
Superseder Nosy List jendrik, malte
Assigned To jendrik Keywords
Optional summary

Created on 2015-02-19.14:56:17 by jendrik, last changed by jendrik.

Messages
msg4022 (view) Author: jendrik Date: 2015-02-20.18:08:59
Merged and pushed.
msg4017 (view) Author: jendrik Date: 2015-02-20.10:42:52
I have run a little microbenchmark and the results seem to be slightly in favor of range-based loops, though there is 
some small variation across different tasks:

experiments/issue510/iterator-microbenchmark$ make -j2 && ./benchmark < .../scanalyzer-sat11-strips/p20.pddl/output
...
Running nothing 10000 times: 2.4e-05 seconds

Running standard loop over operators 10000 times: 5.52003 seconds
Running range-based loop over operators 10000 times: 5.51173 seconds
msg4015 (view) Author: jendrik Date: 2015-02-19.19:08:46
I have uploaded my implementation to 
https://bitbucket.org/jendrikseipp/downward/branch/issue510. Can you have a look, 
please? Fortunately, it's a rather small patch.
msg4014 (view) Author: jendrik Date: 2015-02-19.14:56:17
Instead of

size_t num_operators = operators.size();
    for (size_t i = 0; i < num_operators; ++i)
        do_something(operators[i]);

we'd like to write code à la

for (Operator op : operators)
    do_something(op);
History
Date User Action Args
2015-02-20 18:08:59jendriksetstatus: reviewing -> resolved
messages: + msg4022
2015-02-20 10:42:52jendriksetmessages: + msg4017
2015-02-19 19:08:47jendriksetstatus: unread -> reviewing
messages: + msg4015
2015-02-19 14:56:17jendrikcreate