diff options
| author | Tyge Løvset <[email protected]> | 2022-04-20 11:24:11 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-04-20 11:24:11 +0200 |
| commit | 7c88fc11ef62d5be83fe34fe72da6eadfd64ba6b (patch) | |
| tree | 6651f32a31940a3ab1cbd1dc5d939af7564d08b2 /docs | |
| parent | 9e530276c0bbe84ddc69142053012bcbb6e9d2f0 (diff) | |
| download | STC-modified-7c88fc11ef62d5be83fe34fe72da6eadfd64ba6b.tar.gz STC-modified-7c88fc11ef62d5be83fe34fe72da6eadfd64ba6b.zip | |
Some cleanup after carc / cbox updates.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/carc_api.md | 7 | ||||
| -rw-r--r-- | docs/cbox_api.md | 7 |
2 files changed, 2 insertions, 12 deletions
diff --git a/docs/carc_api.md b/docs/carc_api.md index 23c7ad0a..cc5b3f41 100644 --- a/docs/carc_api.md +++ b/docs/carc_api.md @@ -15,11 +15,6 @@ additional synchronization even if these instances are copies and share ownershi When declaring a container with shared pointers, define `i_val_bind` as the carc type, see example. -Make sure to pass the result of create functions like *carc_X_from()* **only** to *insert()*, -*push_back()*, and *push()* functions, as it is *moved* into the container. Use *emplace()* -method for sharing existing **carc**s between containers or other existing shared pointers, -as they clone/share the input internally. - See similar c++ class [std::shared_ptr](https://en.cppreference.com/w/cpp/memory/shared_ptr) for a functional reference, or Rust [std::sync::Arc](https://doc.rust-lang.org/std/sync/struct.Arc.html) / [std::rc::Rc](https://doc.rust-lang.org/std/rc/struct.Rc.html). ## Header file and declaration @@ -37,7 +32,7 @@ See similar c++ class [std::shared_ptr](https://en.cppreference.com/w/cpp/memory ## Methods ```c carc_X carc_X_init(); // empty shared pointer -carc_X carc_X_make(i_valraw raw); // like carc_X_from(), but construct owned value from raw. +carc_X carc_X_make(i_valraw raw); // construct owned value from raw type carc_X carc_X_from(i_val val); // create new heap allocated object. Take ownership of val. carc_X carc_X_from_ptr(i_val* p); // create a carc from raw pointer. Takes ownership of p. diff --git a/docs/cbox_api.md b/docs/cbox_api.md index 962727b1..556c56df 100644 --- a/docs/cbox_api.md +++ b/docs/cbox_api.md @@ -9,10 +9,6 @@ When declaring a container of **cbox** values, define `i_val_arcbox` with the cbox type instead of defining `i_val`. This will auto-set `i_valdrop`, `i_valfrom`, and `i_cmp` using functions defined by the specified **cbox**. -For containers, make sure to pass the result of create functions like *cbox_X_make()* **only** to -*insert()*, *push_back()*, and *push()* functions. Use the *emplace()* functions in order to -auto-*clone* an already existing/owned cbox element. - See similar c++ class [std::unique_ptr](https://en.cppreference.com/w/cpp/memory/unique_ptr) for a functional reference, or Rust [std::boxed::Box](https://doc.rust-lang.org/std/boxed/struct.Box.html) ## Header file and declaration @@ -35,8 +31,7 @@ compare the pointer addresses when used. Additionally, `c_no_clone` or `i_is_fwd ## Methods ```c cbox_X cbox_X_init(); // return an empty cbox -cbox_X cbox_X_make(i_valraw raw); // like cbox_X_from(), but create owned value from raw. - // NB! available only if i_valraw is defined. +cbox_X cbox_X_make(i_valraw raw); // create owned value from raw type. cbox_X cbox_X_from(i_val val); // allocate new heap object with val. Take ownership of val. cbox_X cbox_X_from_ptr(i_val* p); // create a cbox from a pointer. Takes ownership of p. |
