Many Core Foundation take ranges--a structure of type
CFRange
--as parameters. A range is a meaure of a linear segment; it has a beginning location and a length. To create and initialize this structure you can use the convenience function
CFMakeRange
.
The following code fragment gets the number of subsequent elements in an array that match the first element:
CFRange aRange = CFMakeRange(1, CFArrayGetCount(array)-1); const void *aValue = CFArrayGetValueAtIndex(array, 0); CFIndex numVals = CFArrayGetCountOfValue(array, aRange, aValue);