summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-09-22 12:53:24 +0200
committerTyge Løvset <[email protected]>2021-09-22 12:53:24 +0200
commit7f542d18fedae0e473ed779c2b93479e473b9feb (patch)
tree964541d9d63a7a4fae0457f30815bf113157da1f /docs
parentbc09a3419e12d069a62c020027c7f1f598eb0c30 (diff)
downloadSTC-modified-7f542d18fedae0e473ed779c2b93479e473b9feb.tar.gz
STC-modified-7f542d18fedae0e473ed779c2b93479e473b9feb.zip
Reworked shared pointers, with some smaller API changes.
Diffstat (limited to 'docs')
-rw-r--r--docs/csptr_api.md13
1 files changed, 7 insertions, 6 deletions
diff --git a/docs/csptr_api.md b/docs/csptr_api.md
index 95c4f93c..8aa04ed7 100644
--- a/docs/csptr_api.md
+++ b/docs/csptr_api.md
@@ -33,18 +33,19 @@ The *csptr_X_compare()*, *csptr_X_del()* methods are defined based on the `i_cmp
Use *csptr_X_clone(p)* when sharing ownership of the pointed-to object. For shared pointers stored in containers, define `i_val_csptr` to the shared pointers tag instead of a `i_val` macro. See example below.
```c
csptr_X csptr_X_init(); // empty constructor
-csptr_X csptr_X_make(Value val); // make_shared constructor, fast
+csptr_X csptr_X_make(Value val); // make_shared constructor, like std::make_shared()
csptr_X csptr_X_from(Value* p); // construct from raw pointer
-csptr_X csptr_X_clone(csptr_X ptr); // clone shared (increase use count)
-csptr_X csptr_X_move(csptr_X* self); // fast transfer ownership to another sptr.
-csptr_X_value_t* csptr_X_copy(csptr_X* self, csptr_X other); // copy shared (increase use count)
+csptr_X csptr_X_clone(csptr_X ptr); // return ptr with increased use count
+csptr_X csptr_X_move(csptr_X* self); // transfer ownership to another sptr.
+void csptr_X_take(csptr_X* self, csptr_X other); // take a new-created or moved csptr
+void csptr_X_copy(csptr_X* self, csptr_X other); // copy shared (increase use count)
void csptr_X_del(csptr_X* self); // destruct (decrease use count, free at 0)
long csptr_X_use_count(csptr_X ptr);
void csptr_X_reset(csptr_X* self);
-csptr_X_value_t* csptr_X_reset_make(csptr_X* self, Value val); // assign new sptr with value
-csptr_X_value_t* csptr_X_reset_with(csptr_X* self, Value* p); // slower than reset_make().
+void csptr_X_reset_with(csptr_X* self, Value val); // make and assign new csptr with value
+void csptr_X_reset_from(csptr_X* self, Value* p); // create csptr from p.
int csptr_X_compare(const csptr_X* x, const csptr_X* y);
bool csptr_X_equals(const csptr_X* x, const csptr_X* y);