//我就喜欢匈牙利命名法,匈牙利命名法!不喜欢使用STL范型;管你宏不宏,哈哈...
/* A版:C++宏完美实现For Each ... Next循环(含倒序、支持嵌套),多余";"、"{"、"}"进献给C++;它隐含默认检索变量Index,宏参数包括Item、Collection;嵌套中同名变量Item按局部变量处理,逻辑上也是如此,尽管不建议如此操作。*/
#include <stdio.h>
#define ForEach(T, /* */ Item, /* IN */ Collection) \
for (int Index = 0; Index < sizeof(Collection) / sizeof(Collection[0]); Index ++) \
{ \
T Item= Collection[Index];
#define ForEachRev(T, /* */ Item, /* IN */ Collection) \
for (int Index = sizeof(Collection) / sizeof(Collection[0]) - 1; Index >= 0; Index --) \
{ \
T Item = Collection[Index];
#define ExitFor break;
#define Skip continue;
#define Next }