docs/src/features.md

changeset 854
fe0d69d72bcd
parent 853
d4baf4dd55c3
     1.1 --- a/docs/src/features.md	Thu May 23 19:29:14 2024 +0200
     1.2 +++ b/docs/src/features.md	Thu May 23 20:29:28 2024 +0200
     1.3 @@ -187,7 +187,7 @@
     1.4  `slot` and `kv_data` fields (for example when iterating over maps).
     1.5  
     1.6  If the predefined fields are insufficient for your use case, you can alternatively create your own iterator structure
     1.7 -and place the `CX_ITERATOR_BASE` macro inside.
     1.8 +and place the `CX_ITERATOR_BASE` macro as first member of that structure.
     1.9  
    1.10  Usually an iterator is not mutating the collection it is iterating over.
    1.11  In some programming languages it is even disallowed to change the collection while iterating with foreach.
    1.12 @@ -204,10 +204,10 @@
    1.13  
    1.14  Collections in UCX 3 have several common features.
    1.15  If you want to implement an own collection data type that uses the same features, you can use the
    1.16 -`CX_COLLECTION_MEMBERS` macro at the beginning of your struct to roll out all members a usual UCX collection has.
    1.17 +`CX_COLLECTION_BASE` macro at the beginning of your struct to roll out all members a usual UCX collection has.
    1.18  ```c
    1.19  struct my_fancy_collection_s {
    1.20 -    CX_COLLECTION_MEMBERS
    1.21 +    CX_COLLECTION_BASE;
    1.22      struct my_collection_data_s *data;
    1.23  };
    1.24  ```
    1.25 @@ -225,21 +225,11 @@
    1.26  
    1.27  *Header file:* [list.h](api/list_8h.html)
    1.28  
    1.29 -This header defines a common interface for all list implementations, which is basically as simple as the following
    1.30 -structure.
    1.31 -```c
    1.32 -struct cx_list_s {
    1.33 -    CX_COLLECTION_MEMBERS       // size, capacity, etc.
    1.34 -    cx_list_class const *cl;    // The list class definition
    1.35 -};
    1.36 -```
    1.37 -The actual structure contains one more class pointer that is used when wrapping a list into a pointer-aware list
    1.38 -with `cxListStorePointers()`. What this means, is that - if you want to implement your own list structure - you
    1.39 -only need to cover the case where the list is storing copies of your objects.
    1.40 +This header defines a common interface for all list implementations.
    1.41  
    1.42 -UCX comes with two common list implementations (linked list and array list) that should cover most use cases.
    1.43 -But if you feel the need to implement an own list, the only thing you need to do is to define a struct where
    1.44 -`struct cx_list_s`, and set an appropriate list class that implements the functionality.
    1.45 +UCX already comes with two common list implementations (linked list and array list) that should cover most use cases.
    1.46 +But if you feel the need to implement an own list, the only thing you need to do is to define a struct with a
    1.47 +`struct cx_list_s` as first member, and set an appropriate list class that implements the functionality.
    1.48  It is strongly recommended that this class is shared among all instances of the same list type, because otherwise
    1.49  the `cxListCompare` function cannot use the optimized implementation of your class and will instead fall back to
    1.50  using iterators to compare the contents element-wise.

mercurial