Function

CFBagAddValue

Adds a value to a mutable bag.

Declaration

void CFBagAddValue(CFMutableBagRef theBag, const void *value);

Parameters

theBag

The bag to which value is added.

value

A CFType object or a pointer value to add to theBag (or the value itself, if it fits into the size of a pointer).

Discussion

The value parameter is retained by theBag using the retain callback provided when theBag was created. If value is not of the type expected by the retain callback, the behavior is undefined. If value already exists in the collection, it is simply retained again—no memory is allocated for the added value. Use a CFSet object if you don’t want duplicate values in your collection.

See Also

Modifying a Mutable Bag

CFBagRemoveAllValues

Removes all values from a mutable bag.

CFBagRemoveValue

Removes a value from a mutable bag.

CFBagReplaceValue

Replaces a value in a mutable bag.

CFBagSetValue

Sets a value in a mutable bag.