summaryrefslogtreecommitdiffhomepage
path: root/docs/cptr_api.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/cptr_api.md')
-rw-r--r--docs/cptr_api.md29
1 files changed, 14 insertions, 15 deletions
diff --git a/docs/cptr_api.md b/docs/cptr_api.md
index b6ea7324..c44e08a3 100644
--- a/docs/cptr_api.md
+++ b/docs/cptr_api.md
@@ -22,21 +22,6 @@ affect the names of all cptr types and methods. E.g. declaring `using_cptr(my, c
Note: for shared-ptr **csptr**, "cloning" is done by pointer sharing (ref counting), so *valueClone* is not required and ignored.
- Types
-
-| Type name | Type definition | Used to represent... |
-|:-------------------|:----------------------|:------------------------|
-| `cptr_X` | `cptr_X_value_t *` | The cptr type |
-| `cptr_X_value_t` | `Value` | The cptr element type |
-
-
-| Type name | Type definition | Used to represent... |
-|:--------------------|:--------------------------------------------------------------|:-------------------------|
-| `csptr_X` | `struct { csptr_X_value_t* get; atomic_count_t* use_count; }` | The csptr type |
-| `csptr_X_value_t` | `Value` | The csptr element type |
-| `atomic_count_t` | `long` | The reference counter |
-
-
## Header file
All cptr definitions and prototypes may be included in your C source file by including a single header file.
@@ -64,6 +49,20 @@ void csptr_X_del(csptr_X* self);
int csptr_X_compare(csptr_X* x, csptr_X* y);
```
+## Types
+
+| Type name | Type definition | Used to represent... |
+|:-------------------|:----------------------|:------------------------|
+| `cptr_X` | `cptr_X_value_t *` | The cptr type |
+| `cptr_X_value_t` | `Value` | The cptr element type |
+
+
+| Type name | Type definition | Used to represent... |
+|:--------------------|:--------------------------------------------------------------|:-------------------------|
+| `csptr_X` | `struct { csptr_X_value_t* get; atomic_count_t* use_count; }` | The csptr type |
+| `csptr_X_value_t` | `Value` | The csptr element type |
+| `atomic_count_t` | `long` | The reference counter |
+
## Example
This example shows three different ways to store struct Person in vectors: 1) `cvec<Person>`, 2) `cvec<Person *>`, and 3) `cvec<csptr<Person>>`.