simple foreach macro implementation. for the situations where boost or C++11 can not be used