diff options
| author | Tyge Løvset <[email protected]> | 2022-05-24 11:32:12 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-05-24 11:32:12 +0200 |
| commit | 966100106830f990bc3e1b40a5b5c39b64d5e9b0 (patch) | |
| tree | 3704a5317fedd54f86a95163c6f498c27f6f209f /include | |
| parent | 99bfc38c2517f1ee20db3d9553be177ae6c960c6 (diff) | |
| download | STC-modified-966100106830f990bc3e1b40a5b5c39b64d5e9b0.tar.gz STC-modified-966100106830f990bc3e1b40a5b5c39b64d5e9b0.zip | |
Changed c_forpair(k, v, Map, map) so that k and v are pointers instead of values. This to make it consistent with c_foreach, c_apply, c_apply_arr.
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/ccommon.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index b6023f4b..ffdd0215 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -162,9 +162,9 @@ STC_INLINE char* c_strnstrn(const char *s, const char *needle, ; it.ref != it##_end_.ref; C##_next(&it))
#define c_forpair(key, val, C, cnt) /* structured binding */ \
- for (struct {C##_iter _it; C##_value* _endref; C##_key key; C##_mapped val;} \
+ for (struct {C##_iter _it; C##_value* _endref; const C##_key* key; C##_mapped* val;} \
_ = {C##_begin(&cnt), C##_end(&cnt).ref} \
- ; _._it.ref != _._endref && (_.key = _._it.ref->first, _.val = _._it.ref->second, true) \
+ ; _._it.ref != _._endref && (_.key = &_._it.ref->first, _.val = &_._it.ref->second) \
; C##_next(&_._it))
#define c_forrange(...) c_MACRO_OVERLOAD(c_forrange, __VA_ARGS__)
|
