COMMON: Use c++11 foreach if available
Merge pull request #1123 from klusark/foreach

COMMON: Use c++11 foreach if available