Function

CFArrayCreateMutable

Creates a new empty mutable array.

Declaration

CFMutableArrayRef CFArrayCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFArrayCallBacks *callBacks);

Parameters

allocator

The allocator to use to allocate memory for the new array and its storage for values. Pass NULL or kCFAllocatorDefault to use the current default allocator.

capacity

The maximum number of values that can be contained by the new array. The array starts empty and can grow to this number of values (and it can have less).

Pass 0 to specify that the maximum capacity is not limited. The value must not be negative.

callBacks

A pointer to a CFArrayCallBacks structure initialized with the callbacks for the array to use on each value in the array. A copy of the contents of the callbacks structure is made, so that a pointer to a structure on the stack can be passed in or can be reused for multiple array creations.

If the array contains CFType objects only, then pass kCFTypeArrayCallBacks to use the default callback functions.

This parameter may be NULL, which is treated as if a valid structure of version 0 with all fields NULL had been passed in.

If any of the fields are not valid pointers to functions of the correct type, or this parameter is not a valid pointer to a CFArrayCallBacks structure, the behavior is undefined. If any value put into the array is not one understood by one of the callback functions, the behavior when that callback function is used is undefined.

Return Value

A new mutable array, or NULL if there was a problem creating the object. Ownership follows the The Create Rule.

See Also

CFMutableArray Miscellaneous Functions

CFArrayAppendArray

Adds the values from one array to another array.

CFArrayAppendValue

Adds a value to an array giving it the new largest index.

CFArrayCreateMutableCopy

Creates a new mutable array with the values from another array.

CFArrayExchangeValuesAtIndices

Exchanges the values at two indices of an array.

CFArrayInsertValueAtIndex

Inserts a value into an array at a given index.

CFArrayRemoveAllValues

Removes all the values from an array, making it empty.

CFArrayRemoveValueAtIndex

Removes the value at a given index from an array.

CFArrayReplaceValues

Replaces a range of values in an array.

CFArraySetValueAtIndex

Changes the value at a given index in an array.

CFArraySortValues

Sorts the values in an array using a given comparison function.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software