C++ ranged for loops look like
for( <variable decl> : <container> )
Where <variable decl=""> is a normal variable declaration. So for example
std:vector v<int>:
for(auto i : v) {
}
so probably what you want is
for( auto& deviceName : localDevices ) {
}
This assumes that whatever type
localDevices
is it has the required member functions so that the ranged for loop can be executed, and that the type of an individual item can be deduced.