diff options
| author | Tyge Løvset <[email protected]> | 2022-09-02 23:45:11 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-09-02 23:45:11 +0200 |
| commit | 491a8cba3ee55a1200fc2de8ef3807dd8436f829 (patch) | |
| tree | f877ef241836ca369561cf62d2db465ef3cbeca0 /examples | |
| parent | a2a18a52df4fc10ad453eba7cdfbe2d02a026f0b (diff) | |
| download | STC-modified-491a8cba3ee55a1200fc2de8ef3807dd8436f829.tar.gz STC-modified-491a8cba3ee55a1200fc2de8ef3807dd8436f829.zip | |
Change: carc and cbox defaults to pointer comparison when none of i_cmp, i_less or i_eq is specified. This removes annoying requirement.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/arc_containers.c | 3 | ||||
| -rw-r--r-- | examples/arcvec_erase.c | 5 | ||||
| -rw-r--r-- | examples/box2.c | 3 | ||||
| -rw-r--r-- | examples/new_sptr.c | 1 |
4 files changed, 3 insertions, 9 deletions
diff --git a/examples/arc_containers.c b/examples/arc_containers.c index debc6617..6aa80dcf 100644 --- a/examples/arc_containers.c +++ b/examples/arc_containers.c @@ -12,8 +12,7 @@ #define i_val Map #define i_valdrop(p) (printf("drop Arc:\n"), Map_drop(p)) // no need for atomic ref. count in single thread: -// no compare function available for csmap: -#define i_opt c_no_atomic|c_no_cmp +#define i_opt c_no_atomic #include <stc/carc.h> #define i_type Stack diff --git a/examples/arcvec_erase.c b/examples/arcvec_erase.c index b96f4278..2c9a3daa 100644 --- a/examples/arcvec_erase.c +++ b/examples/arcvec_erase.c @@ -6,9 +6,8 @@ void show_drop(int* x) { printf("drop: %d\n", *x); } #define i_val int #define i_valdrop show_drop // carc/cbox will use pointer address comparison of i_val -// if 'i_opt c_no_cmp' is defined, otherwise i_cmp is used -// to compare object values. See the two differences by -// commenting out the next line. +// if no 'i_cmp' is defined, otherwise 'i_cmp' is used +// to compare object values. #include <stc/carc.h> // Shared pointer to int #define i_type Vec diff --git a/examples/box2.c b/examples/box2.c index 0896388e..75f9970f 100644 --- a/examples/box2.c +++ b/examples/box2.c @@ -18,17 +18,14 @@ struct { } typedef Rectangle; #define i_val Point -#define i_opt c_no_cmp #include <stc/cbox.h> // cbox_Point #define i_val Rectangle -#define i_opt c_no_cmp #include <stc/cbox.h> // cbox_Rectangle // Box in box: #define i_val_arcbox cbox_Point // NB: use i_val_arcbox when value is a cbox or carc! // it will auto define i_valdrop, i_valfrom, and i_cmp. -#define i_opt c_no_cmp #define i_tag BoxPoint #include <stc/cbox.h> // cbox_BoxPoint diff --git a/examples/new_sptr.c b/examples/new_sptr.c index 2af7317e..71222799 100644 --- a/examples/new_sptr.c +++ b/examples/new_sptr.c @@ -15,7 +15,6 @@ void Person_drop(Person* p) { } #define i_val_bind Person -#define i_opt c_no_cmp // makes cmp and hash not required when using _bind #define i_tag person #include <stc/carc.h> |
