diff options
| author | Tyge Løvset <[email protected]> | 2021-12-22 12:35:36 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-12-22 12:35:36 +0100 |
| commit | 79c83eba7933f49e766dbeb85f9c40ee17e06edf (patch) | |
| tree | e43a84d18b79956a8e22b9403358811b6865f344 /examples/box2.c | |
| parent | 7a30e2853792870a1d85087861e46a1ae1ca6b0e (diff) | |
| download | STC-modified-79c83eba7933f49e766dbeb85f9c40ee17e06edf.tar.gz STC-modified-79c83eba7933f49e766dbeb85f9c40ee17e06edf.zip | |
Renamed csptr to carc. i_key/val_ref renamed to i_key/val_sptr. Change inspired by Rust Arc/Rc. cbox name is taken from Rust Box type.
Diffstat (limited to 'examples/box2.c')
| -rw-r--r-- | examples/box2.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/box2.c b/examples/box2.c index 5549dade..d79ea32d 100644 --- a/examples/box2.c +++ b/examples/box2.c @@ -26,8 +26,8 @@ struct { #include <stc/cbox.h> // cbox_Rectangle
// Box in box:
-#define i_val_bind cbox_Point // NB: adviced to use i_val_arc when value is a cbox or csptr!
- // it will auto-set i_drop, i_from, i_cmp for you.
+#define i_val_sptr cbox_Point // NB: adviced to use i_val_sptr when value is a cbox or carc!
+ // it will auto-set i_drop, i_from, i_cmp for you.
#define i_opt c_no_cmp
#define i_tag BoxPoint
#include <stc/cbox.h> // cbox_BoxPoint
@@ -62,10 +62,10 @@ int main(void) { });
// The output of functions can be boxed
- boxed_point = cbox_Point_new(origin());
+ boxed_point = cbox_Point_from(origin());
// Double indirection
- box_in_a_box = cbox_BoxPoint_new(boxed_origin());
+ box_in_a_box = cbox_BoxPoint_from(boxed_origin());
printf("Point occupies %zu bytes on the stack\n",
sizeof(point));
|
