48 *Required modules:* [Allocator](#allocator) |
48 *Required modules:* [Allocator](#allocator) |
49 |
49 |
50 The UCX Array is an implementation of a dynamic array with automatic |
50 The UCX Array is an implementation of a dynamic array with automatic |
51 reallocation. The array structure contains a capacity, the current size, |
51 reallocation. The array structure contains a capacity, the current size, |
52 the size of each element, the raw pointer to the memory area and an allocator. |
52 the size of each element, the raw pointer to the memory area and an allocator. |
53 Unlike an [UcxList](#list), the array structure is typically passed by value, |
53 Arrays are in most cases much faster than linked list. |
54 unless it is subjected to change. Arrays are in most cases much faster than |
54 One can decide, whether to create a new array on the heap with `ucx_array_new()` |
55 linked list. |
55 or to save one indirection by initializing a `UcxArray` structure on the stack |
|
56 with `ucx_array_init()`. |
56 |
57 |
57 ### Remove duplicates from an array of strings |
58 ### Remove duplicates from an array of strings |
58 |
59 |
59 The following example shows, how a `UcxArray` can be built with |
60 The following example shows, how a `UcxArray` can be built with |
60 a standard dynamic C array (pointer+length) as basis. |
61 a standard dynamic C array (pointer+length) as basis. |