[Include] i_foreach - Small and lightweight foreach with custom iterators
#9

Thanks for your observations. I was aware of the spacing issues; there should indeed be no space after new or in, and I am sorry for not making enough tests on the new version (I had limited time and wanted to release it as quickly as possible). Sadly, space detection in Pawn is quite quirky, and I don't have complete understanding of the preprocessor to make it more flexible in this way. The inability to place "i" in the second variable name is surprising; it looks to me like the compiler could do a better job at attempting to recognize the macro.

I agree it is not very flexible, but I originally made this only for my personal use, tailored to my coding style and preferences (spacing). At least the second version doesn't break anything that was possible with the first version (or I am not aware of it).

Minor version 1.1.1 was released to allow a space before "new" (some coding styles have that). I hope it doesn't break something else.

Quote:
Originally Posted by CodeStyle175
View Post
yes thats some quality code over here
PHP Code:
#define foreach(new%9\32;%0\32;%8in%7\32;%1) for(new %9%0%8, iter_name_%1(__iter_)(%9%0%8) = iter_initial_%1, iter_name_%1(__top_)(%9%0%8) = iter_top_%1; iter_name_%1(__iter_)(%9%0%8) <= iter_name_%1(__top_)(%9%0%8); iter_name_%1(__iter_)(%9%0%8)++)if(iter_check_%1(iter_name_%1(__iter_)(%9%0%8))&&(_:!_:(iter_selector_%1(iter_name_%1(__iter_)(%9%0%8))(%9%0%8))+1)) 
Thanks for the compliment!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)