Ranged for

`for (Iter i = c.begin(); i != c.end(); ++i)` is long, noisy,
and the extra capabilities of iterators over a simple foreach
are mostly not needed.

`make check` and `make -C testsuite-real` are happy with
the changes, still this could use a combover from someone
with OCD.  or better, a run of the acceptance tests.

@k0da, @kobliha
The devices.size() is wrong since you later use push_back anyway. Just start with an empty vector.