Made compatible with C++11 for-each clause