diff options
| author | Tyge Løvset <[email protected]> | 2021-06-07 20:49:19 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-06-07 20:49:19 +0200 |
| commit | 28596b49a281d69ce2e28e0c5d7cec9620e0dc80 (patch) | |
| tree | 9a351d2d3969e5fd9f5dbad4507fa1be359ce5c6 /docs | |
| parent | 4569cf7843c510615542afe8bce237be53d79a9f (diff) | |
| download | STC-modified-28596b49a281d69ce2e28e0c5d7cec9620e0dc80.tar.gz STC-modified-28596b49a281d69ce2e28e0c5d7cec9620e0dc80.zip | |
Improved csptr: cstr_make() as fast as std::shared_ptr::make_shared (single malloc). Added assign(), copy().
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/csptr_api.md | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/docs/csptr_api.md b/docs/csptr_api.md index 0acc8b21..6665b23b 100644 --- a/docs/csptr_api.md +++ b/docs/csptr_api.md @@ -36,14 +36,17 @@ Use *csptr_X_clone(p)* when sharing ownership of the pointed-to object. See exam The *csptr_X_compare()*, *csptr_X_equals()* and *csptr_X_del()* methods are defined based on the *valeCompare* and *valueDel* arguments passed to the **using**-macro. ```c -csptr_X csptr_X_from(csptr_X_value_t* ptr); // constructor -csptr_X csptr_X_make(csptr_X_value_t val); // make_shared +csptr_X csptr_X_from(Value* p); // constructor +csptr_X csptr_X_make(Value val); // make_shared void csptr_X_reset(csptr_X* self); -void csptr_X_reset_with(csptr_X* self, csptr_X_value_t* ptr); +void csptr_X_reset_with(csptr_X* self, Value* p); -csptr_X csptr_X_clone(csptr_X sptr); // share the pointer (increase use count) -void csptr_X_move(csptr_X* self); // transfer ownership instead of sharing. -void csptr_X_del(csptr_X* self); // destructor: decrease use count, destroy at 0 +csptr_X_value_t* csptr_X_assign(csptr_X* self, Value val); // assign new sptr with value +csptr_X_value_t* csptr_X_copy(csptr_X* self, csptr_X ptr); // assign a shared copy + +csptr_X csptr_X_clone(csptr_X ptr); // share the pointer (increase use count) +void csptr_X_move(csptr_X* self); // transfer ownership instead of sharing. +void csptr_X_del(csptr_X* self); // destructor: decrease use count, destroy at 0 int csptr_X_compare(csptr_X* x, csptr_X* y); bool csptr_X_equals(csptr_X* x, csptr_X* y); |
