www.delorie.com/gnu/docs/libobjects/libobjects_10.html   search  
 
Buy GNU books!


User's Guide to the GNU Objective-C Class Library

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6. Content types

Collections can hold either objects or primitive C types. More specifically, collections can hold any of the types in the elt union defined in coll/elt.h. All contents of a collection must be of the same type.

You declare which type the collection will hold at collection initialization time, and the type can not be changed later. You specify the type using the Objective-C @encode() directive. You can find out the type held by a collection with the method contentEncoding (see section 15. Querying).

Many operations are independent of the type the collection holds. For example the method -(unsigned)count returns the number of members in the collection.

Other operations need to take arguments of different types depending on whether the contents are objects or some other type. In this case there will be two methods, distinguished by the words Object and Element in their method name. For example, -removeObject:anObject vs -(elt)removeElement:(elt)anElement.

<<Unfinished.>>


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003  

Please take a moment to fill out this visitor survey
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)