summaryrefslogtreecommitdiffhomepage
path: root/examples/sharedptr.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-09-19 14:54:15 +0200
committerTyge Løvset <[email protected]>2021-09-19 14:54:15 +0200
commit0a3fe6211933a8be6ec71ff82a3077da7012e667 (patch)
tree16794698ffac9c3e746b0a02078a4ed7afdf580c /examples/sharedptr.c
parent677e3d855e1d35ae5bf12609e86785a01ce2f4cc (diff)
downloadSTC-modified-0a3fe6211933a8be6ec71ff82a3077da7012e667.tar.gz
STC-modified-0a3fe6211933a8be6ec71ff82a3077da7012e667.zip
Replaced the two csptr doc examples with a better one. Same as sharedptr.c in examples.
Diffstat (limited to 'examples/sharedptr.c')
-rw-r--r--examples/sharedptr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/sharedptr.c b/examples/sharedptr.c
index 40e1be6f..daaf646f 100644
--- a/examples/sharedptr.c
+++ b/examples/sharedptr.c
@@ -43,6 +43,10 @@ int main()
printf("\nset:");
c_foreach (i, csset_int, set) printf(" %d", *i.ref->get);
+ c_forvar (csptr_int p = csptr_int_clone(vec.data[0]), csptr_int_del(&p)) {
+ printf("\n%d is now owned by %zu objects\n", *p.get, *p.use_count);
+ }
+
puts("\nDone");
}
}