I have my own C ++ macro to emulate a foreach loop:
for(COLLECTION_TYPE::iterator ELEMENT
{ TYPE ELEMENT = *(ELEMENT
I know there are alternative ways to make a foreach loop - either using C ++ 11, STL, Qt or Boost foreach, but I'm trying to create my own solution just for fun.
The problem is that this macro either requires completion with two curly braces ("}}"), or omit the first bracket and end with one, for example:
foreach(int, i, std::list<int>, indexes)
{
}}
or
foreach(int, i, std::list<int>, indexes)
}
I was wondering: does this have a smart macro, so can I use this macro as follows?
foreach(int, i, std::list<int>, indexes)
{
}
source
share