diff options
| author | Tyge Løvset <[email protected]> | 2021-04-02 20:23:48 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-04-02 20:23:48 +0200 |
| commit | 9f2e40176d16b882d53700bdc4845939700d4c5b (patch) | |
| tree | 4a4a477b71067c0095b0d6848c45d7f4750aec55 /docs/clist_api.md | |
| parent | 939da174859515952108c49c206884d378704b11 (diff) | |
| download | STC-modified-9f2e40176d16b882d53700bdc4845939700d4c5b.tar.gz STC-modified-9f2e40176d16b882d53700bdc4845939700d4c5b.zip | |
Rewrote clist (2): Similar to std::list API ...
...instead of std::forward_list, but still single linked list representation. Weaker iterator validity, see updated docs.
Diffstat (limited to 'docs/clist_api.md')
| -rw-r--r-- | docs/clist_api.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/clist_api.md b/docs/clist_api.md index 1e4613b3..c14104f5 100644 --- a/docs/clist_api.md +++ b/docs/clist_api.md @@ -9,15 +9,15 @@ Unlike the c++ class *std::forward_list*, **clist** has an API similar to *std:: occupies only one pointer in memory, and like *std::forward_list* the length of the list is not stored. The method *clist_X_size()* is available, however computed in **O**(*n*) time. -Iterator invalidation: Adding, removing and moving the elements within the list, or across several lists +***Iterator invalidation***: Adding, removing and moving the elements within the list, or across several lists will invalidate other iterators currently refering to these elements and their immediate succesive elements. However, an iterator to a succesive element can both be dereferenced and advanced. After advancing (using -*clist_X_next(&it)* or *it = cslist_X_fwd(it, n)*), the iterator is in a fully valid state. This implies: +*clist_X_next(&it)* or *it = cslist_X_fwd(it, n)*), the iterator is in a valid state. This implies: -- `clist_X_insert(&L, clist_X_fwd(it,1))`, is valid only unless `*it.ref` was removed. -- `clist_X_erase_at(&L, clist_X_fwd(it,1))` is valid only unless `*it.ref`was removed or `clist_X_fwd(it,1)` is `end`. -- Iterators returned from *clist_X_insert()* and *clist_X_erase_at()* are either valid or `end`. -- Multiple elements can be safely removed from a list via multiple iterators if done in back to front order. +- `clist_X_insert(&L, clist_X_fwd(it,1))` is valid, unless `*it.ref` was removed. +- `clist_X_erase_at(&L, clist_X_fwd(it,1))` is valid, unless `*it.ref`was removed or `clist_X_fwd(it,1)` is `end`. +- Iterators returned from *clist_X_insert()* and *clist_X_erase_at()* are always valid or `end`. +- Elements can be safely removed from a list via multiple iterators if done in back to front order. See the c++ class [std::forward_list](https://en.cppreference.com/w/cpp/container/forward_list) for a functional description. @@ -74,7 +74,7 @@ size_t clist_X_remove(clist_X* self, RawValue raw); void clist_X_splice(clist_X* self, clist_X_iter_t it, clist_X* other); void clist_X_splice_range(clist_X* self, clist_X_iter_t it, clist_X* other, clist_X_iter_t it1, clist_X_iter_t it2); - // non-std: splice [it1, it2) out of self, returned as clist + // non-std: splice out [it1, it2) of self, returned as a clist clist_X clist_X_splice_out(clist_X* self, clist_X_iter_t it1, clist_X_iter_t it2); clist_X_iter_t clist_X_find(const clist_X* self, RawValue raw); @@ -198,4 +198,4 @@ Output: ``` 1 2 30 40 3 4 5 10 20 50 -```
\ No newline at end of file +``` |
