You can simulate foreach-statement in c++ with macro declaration. I'm using similar syntax for looping arrays in the following way:
int array1[10];
vector<int> array2(10);
fori(array1)
forj(array2)
fork(123)
if(array1[i]==array[j])
return true;
What's your favorite macros for extending c++ language in some way?
EDIT:
Implementation of the macro mentioned in the question is:
#define fori(a) for(int i=0;i<getsize(a);i++)
#define forj(a) for(int j=0;j<getsize(a);j++)
#define foru(a) for(int u=0;u<getsize(a);u++)
#define fork(a) for(int k=0;k<getsize(a);k++)
#define forl(a) for(int l=0;l<getsize(a);l++)
template<typename T>
int getsize(T& v ){return v.size();}
template<typename T,int N>
int getsize(T(&v)[N]){return N;}
int getsize(int v){return v;}