First, let's take a look at the attributes of CCArray: [cpp]/** create an array */static CCArray * create (); /** create an array using some objects */static CCArray * create (CCObject * pObject ,...); /** create an array and put the object in */static CCArray * createWithObject (CCObject * pObject);/** create an array, set the estimated capacity */static CCArray * createWithCapacity (unsigned int capacity);/** create an array in one array */static CCArray * createWithArray (CCArray * otherArray ); /** @ brief import an array through a file @ param pFileName 1 *. Plist Format File @ return returns the CCArray array pointer */static CCArray * createWithContentsOfFile (const char * pFileName);/* @ brief same as above, but does not call autorelease, therefore, you need to execute release () after the call (). */static CCArray * createWithContentsOfFileThreadSafe (const char * pFileName);/** initialize array */bool init (); /** initialize the array through an object */bool initWithObject (CCObject * pObject);/** initialize the array through some objects */bool initWithObjects (CCObject * pObject ,...); /** initialize the array and set the estimation. Capacity */bool initWithCapacity (unsigned int capacity);/** Initialize an array through an array */bool initWithArray (CCArray * otherArray ); // query the Array Function/** returns the number of array elements */unsigned int count () const;/** returns the estimated size of the array */unsigned int capacity () const; /** obtain the subscript of this object in the array through the object. If this object is not in the array, UINT_MAX */unsigned int indexOfObject (CCObject * object) const is returned; /** obtain an element using a correct subscript */CCObject * objectAtIndex (unsigned int index);/** return the last element */ CCObject * lastObject ();/** returns a random element */CCObject * randomObject ();/** determines whether the array contains the object */bool containsObject (CCObject * object) const;/** compare two arrays after 1.1 */bool isw.toarray (CCArray * pOtherArray ); // Add a function/** add an object */void addObject (CCObject * object);/** add all elements of the array */void addObjectsFromArray (CCArray * otherArray ); /** insert an object to a correct subscript position */void insertObject (CCObject * object, unsigned int index );/ /Delete the function/** Delete the last element */void removeLastObject (bool bReleaseObj = true);/** Delete the element of the parameter */void removeObject (CCObject * object, bool bReleaseObj = true);/** use a correct subscript to delete the element */void removeObjectAtIndex (unsigned int index, bool bReleaseObj = true ); /** Delete elements using an array */void removeObjectsInArray (CCArray * otherArray);/** delete all elements */void removeAllObjects (); /** delete an element in a quick way * // the quick way is to fill in the last element to delete after the element is deleted. Location division. This will disrupt the order, and use void fastRemoveObject (CCObject * object) with caution;/** Delete the element at the subscript position in a quick way */void fastRemoveObjectAtIndex (unsigned int index ); // reschedule the content/** switching element */void exchangeObject (CCObject * object1, CCObject * object2 ); /** elements of the Two-cursor exchange */void exchangeObjectAtIndex (unsigned int index1, unsigned int index2 ); /** Replace the specified element with an object */void replaceObjectAtIndex (unsigned int uIndex, CCObject * pObject, bool bReleaseObject = true ); /** flip array */void reverseObjects ();/* zoom out the array so that the memory occupied by the array conforms to the number of elements */void merge cememoryfootprint (); the following section describes the pre-Compilation of CCArrary which can be used for laziness: [cpp] # define CCARRAY_FOREACH (_ array __, _ object _) // traverses all elements, # define CCARRAY_FOREACH_REVERSE (_ array __, _ object _) // reverse traversal element # define CCARRAY_VERIFY_TYPE (_ array __, _ type __) // determine whether the array element belongs to a certain object # define arrayMakeObjectsPerformSelector (pArray, func, elementType) // Let all elements in the array execute a function # define arrayMakeObjectsPerformSelectorWithObject (pArray, func, pObject, elementType) // Let all elements in the array execute a function, with the parameter example: [cpp] CCArray * arr = CCArray: create (); CCObject * pNode; CCARRAY_FOREACH (arr, pNode) {pNode-> retainCount (); // traverses the arr array and enables each element to execute the retainCount () function}