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 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.>>