C++11: Use foreach in ScopDetection