docs/src/modules.md

branch
feature/array
changeset 359
9f86bc73f96b
parent 340
8acf182f6424
child 370
07ac32b385e4
equal deleted inserted replaced
358:885f31c6098b 359:9f86bc73f96b
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.

mercurial