summaryrefslogtreecommitdiffhomepage
path: root/examples/sptr_pthread.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-12 21:33:22 +0100
committerTyge Løvset <[email protected]>2021-12-12 21:33:22 +0100
commitd57b9bb7666753c7cf7ab5a0da6d7d11f303c2af (patch)
tree258690df4a5ab62055261579967d6dfffaf5b0fd /examples/sptr_pthread.c
parent9cd20ebfc4f1e10153ff814085499223265ef902 (diff)
downloadSTC-modified-d57b9bb7666753c7cf7ab5a0da6d7d11f303c2af.tar.gz
STC-modified-d57b9bb7666753c7cf7ab5a0da6d7d11f303c2af.zip
- Added **cbox** type: container of one element: similar to std::unique_ptr / Rust Box.
- Replaced example for **csptr** in docs. - Added [**c_forpair**](docs/ccommon_api.md) macro: for-loop with "structural binding" as in c++. - Deprecated *csptr_X_make()*. Renamed to *csptr_X_new()*. Corresponding **cbox** method is *cbox_X_new()*. - Deprecated *c_default_fromraw(raw)*. Renamed to *c_default_clone(raw)*. - Deprecated `i_key_csptr` / `i_val_csptr`. Use `i_key_ref` / `i_val_ref` when specifying containers with **csptr** or **cbox** elements. - Deprecated `i_cnt`. Use `i_type` instead to define the full container type name. - Bugfixes and docs updates.
Diffstat (limited to 'examples/sptr_pthread.c')
-rw-r--r--examples/sptr_pthread.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/sptr_pthread.c b/examples/sptr_pthread.c
index 0a1b7c79..d82ea938 100644
--- a/examples/sptr_pthread.c
+++ b/examples/sptr_pthread.c
@@ -15,6 +15,7 @@ void Base_del(Base* b) { printf("Base::~Base()\n"); }
#define i_val Base
#define i_del Base_del
+#define i_opt c_no_compare
#define i_tag base
#include <stc/csptr.h>
@@ -34,7 +35,7 @@ void* thr(csptr_base* lp)
int main()
{
- csptr_base p = csptr_base_make((Base){42});
+ csptr_base p = csptr_base_new((Base){42});
printf("Created a Base\n"
" p.get() = %p, p.use_count() = %ld\n", (void*)p.get, *p.use_count);