Function

CFArrayInsertValueAtIndex

Inserts a value into an array at a given index.

Declaration

void CFArrayInsertValueAtIndex(CFMutableArrayRef theArray, CFIndex idx, const void *value);

Parameters

theArray

The array into which value is inserted. If theArray is a fixed-capacity array and it is full before this operation, the behavior is undefined.

idx

The index at which to insert value. The index must be in the range 0 to N inclusive, where N is the count of theArray before the operation. If the index is the same as the count of theArray, this function has the same effect as CFArrayAppendValue.

value

The value to insert into theArray. The value is retained by theArray using the retain callback provided when theArray was created. If value is not of the type expected by the retain callback, the behavior is undefined.

Discussion

The value parameter is assigned to the index idx, and all values in theArray with equal and larger indices have their indices increased by one.

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.

CFArrayCreateMutable

Creates a new empty mutable array.

CFArrayCreateMutableCopy

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

CFArrayExchangeValuesAtIndices

Exchanges the values at two indices of an array.

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