Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is CCARRAY_FOREACH in coccos2d?

I see a macro CCARRAY_FOREACH in coccos2d, actually what does it? can we do alternative solution instead of it?i am using following code for spriteBatchNode?

     CCARRAY_FOREACH([spriteBatch children], sprite)
{

    ...................
}
like image 944
senthilM Avatar asked Feb 02 '11 09:02

senthilM


1 Answers

The other answer is actually wrong. CCARRAY_FOREACH isn't a macro for fast enumeration, it is a replacement for fast enumeration for CCArrays. CCARRAY_FOREACH is a tiny bit faster than fast enumeration on a NS(Mutable)Array (about 10%), so better use it if you are using CCArrays.
Check the CCArray.h header to see what the macro actually is.

like image 104
unexpectedvalue Avatar answered Jan 03 '23 00:01

unexpectedvalue