Is it possible to make a macro to loop through any kind of maps?
Normally, it's
Code:
map<int, string>::iterator it;
for(it = somemap.begin(); it != somemap.end(); it++){
// do schtuff
}
For an xml class I have, I've actually made some looping macros which replaces
Code:
int i;
for(i = 0; i < xmlnode.size(); i++){
xmlnode& tec = xmlnode[i];
// do schtuff
}
into
Code:
xmlloop(xmlnode)
// do stuff with "tec" as a xmlnode&
xmlloopend
So yeah, can the same be done with maps without having to specify their types? that is, I don't want:
Code:
maploop(int, string, somemap)
// do stuff with it, which is an iterator..
maploopend