Contents

withArray

Creates and initializes an OSArray populated with the contents of another array.

Declaration

static OSArray * withArray( 
 const OSArray *array, 
 unsigned int capacity = 0);

Parameters

  • array:

    An OSArray whose contents will be stored in the new instance.

  • capacity:

    The initial storage capacity of the array object. If 0, the capacity is set to the number of objects in array; otherwise capacity must be greater than or equal to the number of objects in array.

Return Value

An instance of OSArray containing the objects of array, with a retain count of 1; NULL on failure.

Overview

array must be non-NULL. If capacity is nonzero, it must be greater than or equal to count. The new array will grow as needed to accommodate more objects (unlikeCFMutableArray, for which the initial capacity is a hard limit).

The objects in array are retained for storage in the new OSArray, not copied.

See Also

Miscellaneous