Creates a new empty mutable bag.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Core Foundation
The allocator object to use to allocate memory for the new bag and its storage for values. Pass
NULLor kCFAllocatorDefault to use the current default allocator.
The maximum number of values that can be contained by the new bag. The bag starts empty and can grow to this number of values (and it can have less). If this parameter is
0, the bag’s maximum capacity is not limited. This value must not be negative.
A pointer to a
CFBagstructure initialized with the callbacks to use to retain, release, describe, and compare values in the bag. 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 collection creations. This parameter may be
NULL, which is treated as if a valid structure of version
0with all fields
NULLhad 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
CFBagstructure, the behavior is undefined. If any value put into the collection is not one understood by one of the callback functions, the behavior when that callback function is used is undefined.
If the collection contains only CFType objects, then pass kCFTypeBagCallBacks as this parameter to use the default callback functions.
A new mutable bag, or
NULL if there was a problem creating the object. Ownership follows the The Create Rule.
This function creates an new empty mutable bag to which you can add values using the
CFBag function. The
capacity parameter specifies the maximum number of values that the CFBag object can contain. If it is
0, then there is no limit to the number of values that can be added (aside from constraints such as available memory).