|
CX Framework
Cross-platform C utility framework
|
Macros | |
| #define | saSlice(out, src, start, end) _saSlice(SAHANDLE(out), SAREF(src), start, end) |
| #define | saClone(out, src) _saSlice(SAHANDLE(out), SAREF(src), 0, 0) |
| #define | saMerge(out, ...) |
| #define | saMergeF(out, flags, ...) |
| #define saClone | ( | out, | |
| src | |||
| ) | _saSlice(SAHANDLE(out), SAREF(src), 0, 0) |
void saClone(sa_type *out, sa_type src)
Creates a deep copy of the entire array
This is a convenience wrapper around saSlice that copies all elements. All elements are deep copied into the new array.
| out | Pointer to uninitialized array to receive the clone |
| src | Source array to clone (passed by value) |
Example:
| #define saMerge | ( | out, | |
| ... | |||
| ) |
void saMerge(sa_type *out, sa_type array1, sa_type array2, ...)
Creates a new array by concatenating multiple source arrays
All elements from all source arrays are deep copied into the new array in order. Source arrays must all be the same element type. The output inherits flags from the first source array.
| out | Pointer to uninitialized array to receive the merged result |
| ... | Variable number of source arrays to merge (passed by value) |
Example:
| #define saMergeF | ( | out, | |
| flags, | |||
| ... | |||
| ) |
void saMergeF(sa_type *out, flags_t flags, sa_type array1, sa_type array2, ...)
Creates a new array by merging multiple source arrays with specified flags
Like saMerge but allows specifying flags. If SA_Unique is set, duplicate elements are not inserted (requires element type to support equality comparison).
| out | Pointer to uninitialized array to receive the merged result |
| flags | Merge flags (e.g., SA_Unique to exclude duplicates) |
| ... | Variable number of source arrays to merge (passed by value) |
Example:
| #define saSlice | ( | out, | |
| src, | |||
| start, | |||
| end | |||
| ) | _saSlice(SAHANDLE(out), SAREF(src), start, end) |
void saSlice(sa_type *out, sa_type src, int32 start, int32 end)
Creates a new array containing a slice (subrange) of the source array
All elements in the range are deep copied into the new array. The source array is unmodified. Negative indices count from the end of the array.
| out | Pointer to uninitialized array to receive the slice |
| src | Source array to slice from (passed by value) |
| start | Starting index (inclusive), negative counts from end |
| end | Ending index (exclusive), 0 means to end of array, negative counts from end |
Example: