diff options
| author | Tyge Løvset <[email protected]> | 2020-12-31 12:31:31 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-12-31 12:31:31 +0100 |
| commit | de498e1649d1f57d4d79f81f47157ee3513ce122 (patch) | |
| tree | 481e09de4041a76c68fb38940399cbc1b728dcbe /docs/cptr_api.md | |
| parent | eb77562a0d74062cd046bdca45d937360c96697c (diff) | |
| download | STC-modified-de498e1649d1f57d4d79f81f47157ee3513ce122.tar.gz STC-modified-de498e1649d1f57d4d79f81f47157ee3513ce122.zip | |
Added links to documentation of similar C++ classes.
Diffstat (limited to 'docs/cptr_api.md')
| -rw-r--r-- | docs/cptr_api.md | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/cptr_api.md b/docs/cptr_api.md index 2d626fa8..30055f00 100644 --- a/docs/cptr_api.md +++ b/docs/cptr_api.md @@ -1,6 +1,8 @@ # Module [cptr](../stc/cptr.h): Smart Pointers -This describes the API of the pointer type **cptr** and the shared pointer type **csptr**. Type **cptr** is meant to be used like a c++ *std::unique_ptr*, while **csptr** is similar to c++ *std::shared_ptr*. +This describes the API of the pointer type **cptr** and the shared pointer type **csptr**. Type **cptr** can be used similar to a c++ +[std::unique_ptr](https://en.cppreference.com/w/cpp/memory/unique_ptr), while **csptr** is similar to a c++ +[std::shared_ptr](https://en.cppreference.com/w/cpp/memory/shared_ptr). **cptr** and **csptr** objects can be used as items of containers. The pointed-to elements are automatically destructed+deleted when the container is destructed. **csptr** elements are only deleted if there are no other shared references to the element. **csptr** has thread-safe atomic use count, enabled by the *csptr_X_share(sp)* and *csptr_X_del(&sp)* methods. @@ -109,7 +111,7 @@ int main() { cvec_ps_sort(&svec); c_foreach (i, cvec_ps, svec) printf(" %s %s\n", i.ref->get->name.str, i.ref->get->last.str); - + csptr_ps x = csptr_ps_share(svec.data[1]); puts("\nDestroy svec:"); |
