diff options
| author | Tyge Løvset <[email protected]> | 2021-01-19 15:59:01 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-01-19 15:59:01 +0100 |
| commit | b16aa1db5d453f19a1851b411e7ec67a653782ff (patch) | |
| tree | f33839c7ba2e73aac3dab63ae356e76e27546acd /docs/cvec_api.md | |
| parent | 19c810bfe2e4dbb9026a1519880a0fb1fa466bad (diff) | |
| download | STC-modified-b16aa1db5d453f19a1851b411e7ec67a653782ff.tar.gz STC-modified-b16aa1db5d453f19a1851b411e7ec67a653782ff.zip | |
Renamed cbitset to cbits. Added more docs.
Diffstat (limited to 'docs/cvec_api.md')
| -rw-r--r-- | docs/cvec_api.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/cvec_api.md b/docs/cvec_api.md index 53c9e0f2..b19cf436 100644 --- a/docs/cvec_api.md +++ b/docs/cvec_api.md @@ -4,6 +4,10 @@ A **cvec** is a sequence container that encapsulates dynamic size arrays. See [std::vector](https://en.cppreference.com/w/cpp/container/vector) for a similar c++ class. +The storage of the vector is handled automatically, being expanded and contracted as needed. Vectors usually occupy more space than static arrays, because more memory is allocated to handle future growth. This way a vector does not need to reallocate each time an element is inserted, but only when the additional memory is exhausted. The total amount of allocated memory can be queried using *cvec_X_capacity()* function. Extra memory can be returned to the system via a call to *cvec_X_shrink_to_fit()*. + +Reallocations are usually costly operations in terms of performance. The *cvec_X_reserve()* function can be used to eliminate reallocations if the number of elements is known beforehand. + ## Declaration ```c |
