continue foreach refactoring work from pr #135
and commitid 15d668e9689beebb1a56e42c3076df27542c50de
Merge pull request #138 from torstehu/cpp-foreach-conv

Continue foreach refactoring work from pr #135

I appreciate the update; I'm an old-school C-user so this stuff is new to me.  Seems correct though, at first glance.