diff options
| author | Tyge Løvset <[email protected]> | 2022-08-11 17:58:15 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-08-11 17:58:15 +0200 |
| commit | 5cf6b762012168be51b32a1a85ab2bc33504f020 (patch) | |
| tree | 9fd59787a0d33d23196b77cecbd31ef5d44e103a /docs/carc_api.md | |
| parent | 9831e8d6ee6772a4f9899cf9e3d36e3de47bbaf5 (diff) | |
| download | STC-modified-5cf6b762012168be51b32a1a85ab2bc33504f020.tar.gz STC-modified-5cf6b762012168be51b32a1a85ab2bc33504f020.zip | |
Fixed issue with cbox / carc. Minor update some examples.
Diffstat (limited to 'docs/carc_api.md')
| -rw-r--r-- | docs/carc_api.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/carc_api.md b/docs/carc_api.md index 687e9547..243349a8 100644 --- a/docs/carc_api.md +++ b/docs/carc_api.md @@ -32,8 +32,8 @@ 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_from(i_valraw raw); // construct a new value in an carc from raw type. -carc_X carc_X_make(i_val val); // make a carc from constructed val object. Faster than from_ptr(). +carc_X carc_X_new(i_valraw raw); // construct a new value in an carc from raw type. +carc_X carc_X_from(i_val val); // create a carc from constructed val object. Faster than from_ptr(). carc_X carc_X_from_ptr(i_val* p); // create a carc from raw pointer. Takes ownership of p. carc_X carc_X_clone(carc_X other); // return other with increased use count @@ -96,18 +96,18 @@ int main() // POPULATE s1 with shared pointers to Map: Map *map; - map = Stack_push(&s1, Arc_make(Map_init()))->get; // push empty map to s1. + map = Stack_push(&s1, Arc_from(Map_init()))->get; // push empty map to s1. c_forarray (Map_raw, v, { {"Joey", 1990}, {"Mary", 1995}, {"Joanna", 1992}}) { Map_emplace(map, v->first, v->second); // populate it. } - map = Stack_push(&s1, Arc_make(Map_init()))->get; + map = Stack_push(&s1, Arc_from(Map_init()))->get; c_forarray (Map_raw, v, { {"Rosanna", 2001}, {"Brad", 1999}, {"Jack", 1980} }) { Map_emplace(map, v->first, v->second); } // POPULATE s2: - map = Stack_push(&s2, Arc_make(Map_init()))->get; + map = Stack_push(&s2, Arc_from(Map_init()))->get; c_forarray (Map_raw, v, { {"Steve", 1979}, {"Rick", 1974}, {"Tracy", 2003} }) { Map_emplace(map, v->first, v->second); } @@ -118,7 +118,7 @@ int main() // Deep-copy (does not share) a Map from s1 to s2. // s2 will contain two shared and two unshared maps. - map = Stack_push(&s2, Arc_make(Map_clone(*s1.data[1].get)))->get; + map = Stack_push(&s2, Arc_from(Map_clone(*s1.data[1].get)))->get; // Add one more element to the cloned map: Map_emplace_or_assign(map, "Cloned", 2022); |
