diff options
| author | Tyge Løvset <[email protected]> | 2022-11-14 11:04:40 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-11-14 11:04:40 +0100 |
| commit | bb67f7192b7786792794b783a3d11c3e61d92c39 (patch) | |
| tree | 037ea2229ccc698b2d73c6dfde668abebb1a23d8 /include/stc | |
| parent | bed7d49063cab3c4f2addb7d06af8db631a3b846 (diff) | |
| download | STC-modified-bb67f7192b7786792794b783a3d11c3e61d92c39.tar.gz STC-modified-bb67f7192b7786792794b783a3d11c3e61d92c39.zip | |
Internal update.
Diffstat (limited to 'include/stc')
| -rw-r--r-- | include/stc/alt/csmap.h | 26 | ||||
| -rw-r--r-- | include/stc/carc.h | 12 | ||||
| -rw-r--r-- | include/stc/carr2.h | 4 | ||||
| -rw-r--r-- | include/stc/carr3.h | 4 | ||||
| -rw-r--r-- | include/stc/cbox.h | 16 | ||||
| -rw-r--r-- | include/stc/ccommon.h | 2 | ||||
| -rw-r--r-- | include/stc/cdeq.h | 28 | ||||
| -rw-r--r-- | include/stc/clist.h | 16 | ||||
| -rw-r--r-- | include/stc/cmap.h | 18 | ||||
| -rw-r--r-- | include/stc/cpque.h | 10 | ||||
| -rw-r--r-- | include/stc/csmap.h | 26 | ||||
| -rw-r--r-- | include/stc/cstack.h | 10 | ||||
| -rw-r--r-- | include/stc/cvec.h | 22 | ||||
| -rw-r--r-- | include/stc/template.h | 38 |
14 files changed, 116 insertions, 116 deletions
diff --git a/include/stc/alt/csmap.h b/include/stc/alt/csmap.h index 4cf7c2d7..c1ceb756 100644 --- a/include/stc/alt/csmap.h +++ b/include/stc/alt/csmap.h @@ -92,12 +92,12 @@ typedef _i_SET_ONLY( i_keyraw ) _i_MAP_ONLY( struct { i_keyraw first; i_valraw second; } ) _cx_raw; -#if !defined _i_no_clone +#if !defined i_no_clone STC_API _cx_self _cx_memb(_clone)(_cx_self cx); -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_API _cx_result _cx_memb(_emplace)(_cx_self* self, i_keyraw rkey _i_MAP_ONLY(, i_valraw rmapped)); -#endif // !_i_no_emplace -#endif // !_i_no_clone +#endif // !i_no_emplace +#endif // !i_no_clone STC_API _cx_self _cx_memb(_init)(void); STC_API _cx_result _cx_memb(_insert)(_cx_self* self, i_key key _i_MAP_ONLY(, i_val mapped)); STC_API _cx_result _cx_memb(_push)(_cx_self* self, _cx_value _val); @@ -146,7 +146,7 @@ _cx_memb(_value_drop)(_cx_value* val) { _i_MAP_ONLY( i_valdrop((&val->second)); ) } -#if !defined _i_no_clone +#if !defined i_no_clone STC_INLINE _cx_value _cx_memb(_value_clone)(_cx_value _val) { *_i_keyref(&_val) = i_keyclone((*_i_keyref(&_val))); @@ -161,10 +161,10 @@ _cx_memb(_copy)(_cx_self *self, const _cx_self* other) { _cx_memb(_drop)(self); *self = _cx_memb(_clone)(*other); } -#endif // !_i_no_clone +#endif // !i_no_clone #ifndef _i_isset - #if !defined _i_no_clone && !defined _i_no_emplace + #if !defined i_no_clone && !defined i_no_emplace STC_API _cx_result _cx_memb(_emplace_or_assign)(_cx_self* self, i_keyraw rkey, i_valraw rmapped); #endif STC_API _cx_result _cx_memb(_insert_or_assign)(_cx_self* self, i_key key, i_val mapped); @@ -262,7 +262,7 @@ _cx_memb(_push)(_cx_self* self, _cx_value _val) { res.ref->second = mapped; return res; } - #if !defined _i_no_clone && !defined _i_no_emplace + #if !defined i_no_clone && !defined i_no_emplace STC_DEF _cx_result _cx_memb(_emplace_or_assign)(_cx_self* self, i_keyraw rkey, i_valraw rmapped) { _cx_result res = _cx_memb(_insert_entry_)(self, rkey); @@ -273,7 +273,7 @@ _cx_memb(_push)(_cx_self* self, _cx_value _val) { res.ref->second = i_valfrom(rmapped); return res; } - #endif // !_i_no_clone && !_i_no_emplace + #endif // !i_no_clone && !i_no_emplace #endif // !_i_isset STC_DEF _cx_value* @@ -456,7 +456,7 @@ _cx_memb(_erase_range)(_cx_self* self, _cx_iter it1, _cx_iter it2) { } } -#if !defined _i_no_clone +#if !defined i_no_clone static _cx_node* _cx_memb(_clone_r_)(_cx_node *tn) { if (! tn->level) @@ -473,9 +473,9 @@ STC_DEF _cx_self _cx_memb(_clone)(_cx_self cx) { return c_init(_cx_self){_cx_memb(_clone_r_)(cx.root), cx.size}; } -#endif // !_i_no_clone +#endif // !i_no_clone -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_DEF _cx_result _cx_memb(_emplace)(_cx_self* self, i_keyraw rkey _i_MAP_ONLY(, i_valraw rmapped)) { _cx_result res = _cx_memb(_insert_entry_)(self, rkey); @@ -485,7 +485,7 @@ _cx_memb(_emplace)(_cx_self* self, i_keyraw rkey _i_MAP_ONLY(, i_valraw rmapped) } return res; } -#endif // _i_no_emplace +#endif // i_no_emplace static void _cx_memb(_drop_r_)(_cx_node* tn) { diff --git a/include/stc/carc.h b/include/stc/carc.h index 69a5660e..31cfa387 100644 --- a/include/stc/carc.h +++ b/include/stc/carc.h @@ -79,10 +79,10 @@ int main() { #define _i_prefix carc_ #endif #if !(defined i_cmp || defined i_less || defined i_keyclass || defined i_valclass) - #define _i_no_cmp + #define i_no_cmp #endif #if !(defined i_eq || defined i_hash || defined i_keyclass || defined i_valclass) - #define _i_no_hash + #define i_no_hash #endif #include "template.h" typedef i_keyraw _cx_raw; @@ -149,7 +149,7 @@ STC_INLINE void _cx_memb(_reset_to)(_cx_self* self, _cx_value* p) { *self = _cx_memb(_from_ptr)(p); } -#ifndef _i_no_emplace +#ifndef i_no_emplace STC_INLINE _cx_self _cx_memb(_from)(_cx_raw raw) { return _cx_memb(_make)(i_keyfrom(raw)); } #else @@ -178,7 +178,7 @@ STC_INLINE void _cx_memb(_take)(_cx_self* self, _cx_self ptr) { } STC_INLINE int _cx_memb(_raw_cmp)(const _cx_raw* rx, const _cx_raw* ry) { - #if defined _i_no_cmp + #if defined i_no_cmp return memcmp(rx, ry, sizeof *rx); #else return i_cmp(rx, ry); @@ -186,7 +186,7 @@ STC_INLINE int _cx_memb(_raw_cmp)(const _cx_raw* rx, const _cx_raw* ry) { } STC_INLINE uint64_t _cx_memb(_raw_hash)(const _cx_raw* rx) { - #if defined _i_no_hash + #if defined i_no_hash return c_default_hash(rx); #else return i_hash(rx); @@ -194,7 +194,7 @@ STC_INLINE uint64_t _cx_memb(_raw_hash)(const _cx_raw* rx) { } STC_INLINE bool _cx_memb(_raw_eq)(const _cx_raw* rx, const _cx_raw* ry) { - #if defined _i_no_hash + #if defined i_no_hash return memcmp(rx, ry, sizeof *rx) == 0; #else return i_eq(rx, ry); diff --git a/include/stc/carr2.h b/include/stc/carr2.h index e96d3c6a..1399b8f6 100644 --- a/include/stc/carr2.h +++ b/include/stc/carr2.h @@ -65,7 +65,7 @@ STC_API _cx_self _cx_memb(_with_size)(size_t xdim, size_t ydim, i_key null); STC_API _cx_self _cx_memb(_with_data)(size_t xdim, size_t ydim, _cx_value* storage); STC_API _cx_value* _cx_memb(_release)(_cx_self* self); STC_API void _cx_memb(_drop)(_cx_self* self); -#if !defined _i_no_clone +#if !defined i_no_clone STC_API _cx_self _cx_memb(_clone)(_cx_self src); STC_API void _cx_memb(_copy)(_cx_self *self, const _cx_self* other); #endif @@ -117,7 +117,7 @@ STC_DEF _cx_self _cx_memb(_with_size)(size_t xdim, size_t ydim, i_key null) { return _arr; } -#if !defined _i_no_clone +#if !defined i_no_clone STC_DEF _cx_self _cx_memb(_clone)(_cx_self src) { _cx_self _arr = _cx_memb(_new_uninit)(src.xdim, src.ydim); diff --git a/include/stc/carr3.h b/include/stc/carr3.h index 3fe9e8ae..0197e4f5 100644 --- a/include/stc/carr3.h +++ b/include/stc/carr3.h @@ -67,7 +67,7 @@ STC_API _cx_self _cx_memb(_with_size)(size_t xdim, size_t ydim, size_t zdim, i STC_API _cx_self _cx_memb(_with_data)(size_t xdim, size_t ydim, size_t zdim, _cx_value* storage); STC_API _cx_value* _cx_memb(_release)(_cx_self* self); STC_API void _cx_memb(_drop)(_cx_self* self); -#if !defined _i_no_clone +#if !defined i_no_clone STC_API _cx_self _cx_memb(_clone)(_cx_self src); STC_API void _cx_memb(_copy)(_cx_self *self, const _cx_self* other); #endif @@ -122,7 +122,7 @@ STC_DEF _cx_self _cx_memb(_with_size)(size_t xdim, size_t ydim, size_t zdim, i_k return _arr; } -#if !defined _i_no_clone +#if !defined i_no_clone STC_DEF _cx_self _cx_memb(_clone)(_cx_self src) { _cx_self _arr = _cx_memb(_new_uninit)(src.xdim, src.ydim, src.zdim); diff --git a/include/stc/cbox.h b/include/stc/cbox.h index cf9e1b5a..4c63d322 100644 --- a/include/stc/cbox.h +++ b/include/stc/cbox.h @@ -71,10 +71,10 @@ int main() { #define _i_prefix cbox_ #endif #if !(defined i_cmp || defined i_less || defined i_keyclass || defined i_valclass) - #define _i_no_cmp + #define i_no_cmp #endif #if !(defined i_eq || defined i_hash || defined i_keyclass || defined i_valclass) - #define _i_no_hash + #define i_no_hash #endif #include "template.h" typedef i_keyraw _cx_raw; @@ -128,7 +128,7 @@ STC_INLINE void _cx_memb(_reset_to)(_cx_self* self, _cx_value* p) { self->get = p; } -#ifndef _i_no_emplace +#ifndef i_no_emplace STC_INLINE _cx_self _cx_memb(_from)(_cx_raw raw) { return _cx_memb(_make)(i_keyfrom(raw)); } #else @@ -136,7 +136,7 @@ STC_INLINE _cx_self _cx_memb(_from)(_cx_value val) { return _cx_memb(_make)(val); } #endif -#if !defined _i_no_clone +#if !defined i_no_clone STC_INLINE _cx_self _cx_memb(_clone)(_cx_self other) { if (!other.get) return other; @@ -144,7 +144,7 @@ STC_INLINE _cx_self _cx_memb(_from)(_cx_value val) *out.get = i_keyclone(*other.get); return out; } -#endif // !_i_no_clone +#endif // !i_no_clone STC_INLINE void _cx_memb(_take)(_cx_self* self, _cx_self other) { if (other.get != self->get) @@ -153,7 +153,7 @@ STC_INLINE void _cx_memb(_take)(_cx_self* self, _cx_self other) { } STC_INLINE int _cx_memb(_raw_cmp)(const _cx_raw* rx, const _cx_raw* ry) { - #if defined _i_no_cmp + #if defined i_no_cmp return memcmp(rx, ry, sizeof *rx); #else return i_cmp(rx, ry); @@ -161,7 +161,7 @@ STC_INLINE int _cx_memb(_raw_cmp)(const _cx_raw* rx, const _cx_raw* ry) { } STC_INLINE uint64_t _cx_memb(_raw_hash)(const _cx_raw* rx) { - #if defined _i_no_hash + #if defined i_no_hash return c_default_hash(rx); #else return i_hash(rx); @@ -169,7 +169,7 @@ STC_INLINE uint64_t _cx_memb(_raw_hash)(const _cx_raw* rx) { } STC_INLINE bool _cx_memb(_raw_eq)(const _cx_raw* rx, const _cx_raw* ry) { - #if defined _i_no_hash + #if defined i_no_hash return memcmp(rx, ry, sizeof *rx) == 0; #else return i_eq(rx, ry); diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index 935d10d9..56b6cdd1 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -106,7 +106,7 @@ #define c_no_clone (1<<2) #define c_no_cmp (1<<3) #define c_no_hash (1<<4) -#define c_no_from (1<<5) +#define c_no_emplace (1<<5) /* Generic algorithms */ diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h index d1102e32..62ddc3ea 100644 --- a/include/stc/cdeq.h +++ b/include/stc/cdeq.h @@ -52,12 +52,12 @@ STC_API _cx_value* _cx_memb(_push)(_cx_self* self, i_key value); STC_API void _cx_memb(_shrink_to_fit)(_cx_self *self); #if !defined _i_queue -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_API _cx_iter _cx_memb(_emplace_range)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, const _cx_raw* p2); -#endif // _i_no_emplace +#endif // i_no_emplace -#if !defined _i_no_cmp +#if !defined i_no_cmp STC_API _cx_iter _cx_memb(_find_in)(_cx_iter p1, _cx_iter p2, _cx_raw raw); STC_API int _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y); #endif @@ -67,12 +67,12 @@ STC_API _cx_iter _cx_memb(_insert_range)(_cx_self* self, _cx_value* pos, const _cx_value* p1, const _cx_value* p2); #endif // !_i_queue -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw) { return _cx_memb(_push)(self, i_keyfrom(raw)); } #endif -#if !defined _i_no_clone +#if !defined i_no_clone #if !defined _i_queue STC_API _cx_iter _cx_memb(_copy_range)(_cx_self* self, _cx_value* pos, const _cx_value* p1, const _cx_value* p2); @@ -87,7 +87,7 @@ STC_INLINE void _cx_memb(_copy)(_cx_self *self, const _cx_self* other) { STC_API _cx_self _cx_memb(_clone)(_cx_self cx); STC_INLINE i_key _cx_memb(_value_clone)(i_key val) { return i_keyclone(val); } -#endif // !_i_no_clone +#endif // !i_no_clone STC_INLINE size_t _cx_memb(_size)(const _cx_self* cx) { return cdeq_rep_(cx)->size; } STC_INLINE size_t _cx_memb(_capacity)(const _cx_self* cx) { return cdeq_rep_(cx)->cap; } STC_INLINE bool _cx_memb(_empty)(const _cx_self* cx) { return !cdeq_rep_(cx)->size; } @@ -156,7 +156,7 @@ _cx_memb(_erase_range)(_cx_self* self, _cx_iter i1, _cx_iter i2) { return _cx_memb(_erase_range_p)(self, i1.ref, _it2_ptr(i1, i2)); } -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_INLINE _cx_value* _cx_memb(_emplace_front)(_cx_self* self, _cx_raw raw) { return _cx_memb(_push_front)(self, i_keyfrom(raw)); @@ -174,9 +174,9 @@ STC_INLINE _cx_iter _cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, _cx_raw raw) { return _cx_memb(_emplace_range)(self, _it_ptr(it), &raw, &raw + 1); } -#endif // !_i_no_emplace +#endif // !i_no_emplace -#if !defined _i_no_cmp +#if !defined i_no_cmp STC_INLINE _cx_iter _cx_memb(_find)(const _cx_self* self, _cx_raw raw) { @@ -402,7 +402,7 @@ _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, _cx_value* p2) { return c_init(_cx_iter){p2 == end ? NULL : p1, end - len}; } -#if !defined _i_no_clone +#if !defined i_no_clone STC_DEF _cx_iter _cx_memb(_copy_range)(_cx_self* self, _cx_value* pos, const _cx_value* p1, const _cx_value* p2) { @@ -412,9 +412,9 @@ _cx_memb(_copy_range)(_cx_self* self, _cx_value* pos, *p++ = i_keyclone((*p1)); return it; } -#endif // !_i_no_clone +#endif // !i_no_clone -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_DEF _cx_iter _cx_memb(_emplace_range)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, const _cx_raw* p2) { @@ -424,9 +424,9 @@ _cx_memb(_emplace_range)(_cx_self* self, _cx_value* pos, *p++ = i_keyfrom((*p1)); return it; } -#endif // !_i_no_emplace +#endif // !i_no_emplace -#if !defined _i_no_cmp +#if !defined i_no_cmp STC_DEF _cx_iter _cx_memb(_find_in)(_cx_iter i1, _cx_iter i2, _cx_raw raw) { diff --git a/include/stc/clist.h b/include/stc/clist.h index b5f9c233..cb692eae 100644 --- a/include/stc/clist.h +++ b/include/stc/clist.h @@ -97,7 +97,7 @@ STC_API _cx_value* _cx_memb(_push_front)(_cx_self* self, i_key value); STC_API _cx_iter _cx_memb(_insert_at)(_cx_self* self, _cx_iter it, i_key value); STC_API _cx_iter _cx_memb(_erase_at)(_cx_self* self, _cx_iter it); STC_API _cx_iter _cx_memb(_erase_range)(_cx_self* self, _cx_iter it1, _cx_iter it2); -#if !defined _i_no_cmp +#if !defined i_no_cmp STC_API size_t _cx_memb(_remove)(_cx_self* self, _cx_raw val); STC_API _cx_iter _cx_memb(_find_in)(_cx_iter it1, _cx_iter it2, _cx_raw val); STC_API int _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y); @@ -111,7 +111,7 @@ STC_API _cx_value* _cx_memb(_insert_node_after)(_cx_self* self, _cx_node* r STC_API _cx_node* _cx_memb(_unlink_node_after)(_cx_self* self, _cx_node* ref); STC_API void _cx_memb(_erase_node_after)(_cx_self* self, _cx_node* ref); -#if !defined _i_no_clone +#if !defined i_no_clone STC_API _cx_self _cx_memb(_clone)(_cx_self cx); STC_INLINE i_key _cx_memb(_value_clone)(i_key val) { return i_keyclone(val); } @@ -120,9 +120,9 @@ _cx_memb(_copy)(_cx_self *self, const _cx_self* other) { if (self->last == other->last) return; _cx_memb(_drop)(self); *self = _cx_memb(_clone)(*other); } -#endif // !_i_no_clone +#endif // !i_no_clone -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, _cx_raw raw) { return _cx_memb(_push_back)(self, i_keyfrom(raw)); } STC_INLINE _cx_value* _cx_memb(_emplace_front)(_cx_self* self, _cx_raw raw) @@ -131,7 +131,7 @@ STC_INLINE _cx_iter _cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, _cx_r { return _cx_memb(_insert_at)(self, it, i_keyfrom(raw)); } STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw) { return _cx_memb(_push_back)(self, i_keyfrom(raw)); } -#endif // !_i_no_emplace +#endif // !i_no_emplace STC_INLINE _cx_self _cx_memb(_init)(void) { return c_init(_cx_self){NULL}; } STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, size_t n) { return true; } @@ -183,7 +183,7 @@ _cx_memb(_splice_range)(_cx_self* self, _cx_iter it, return _cx_memb(_splice)(self, it, &tmp); } -#if !defined _i_no_cmp +#if !defined i_no_cmp STC_INLINE _cx_iter _cx_memb(_find)(const _cx_self* self, _cx_raw val) { return _cx_memb(_find_in)(_cx_memb(_begin)(self), _cx_memb(_end)(self), val); @@ -265,7 +265,7 @@ _clist_mergesort(clist_VOID_node *list, int (*cmp)(const clist_VOID_node*, const // -------------------------- IMPLEMENTATION ------------------------- #if defined(i_implement) -#if !defined _i_no_clone +#if !defined i_no_clone STC_DEF _cx_self _cx_memb(_clone)(_cx_self cx) { _cx_self out = _cx_memb(_init)(); @@ -398,7 +398,7 @@ _cx_memb(_split_off)(_cx_self* self, _cx_iter it1, _cx_iter it2) { return lst; } -#if !defined _i_no_cmp +#if !defined i_no_cmp STC_DEF _cx_iter _cx_memb(_find_in)(_cx_iter it1, _cx_iter it2, _cx_raw val) { diff --git a/include/stc/cmap.h b/include/stc/cmap.h index 45b1d81d..a6b63679 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -97,7 +97,7 @@ typedef _i_SET_ONLY( i_keyraw ) _cx_raw; STC_API _cx_self _cx_memb(_with_capacity)(size_t cap); -#if !defined _i_no_clone +#if !defined i_no_clone STC_API _cx_self _cx_memb(_clone)(_cx_self map); #endif STC_API void _cx_memb(_drop)(_cx_self* self); @@ -121,7 +121,7 @@ STC_INLINE bool _cx_memb(_contains)(const _cx_self* self, _cx_rawkey rke #ifndef _i_isset STC_API _cx_result _cx_memb(_insert_or_assign)(_cx_self* self, i_key _key, i_val _mapped); - #if !defined _i_no_emplace + #if !defined i_no_emplace STC_API _cx_result _cx_memb(_emplace_or_assign)(_cx_self* self, _cx_rawkey rkey, i_valraw rmapped); #endif @@ -136,7 +136,7 @@ STC_INLINE bool _cx_memb(_contains)(const _cx_self* self, _cx_rawkey rke { return (_cx_mapped*)_cx_memb(_at)(self, rkey); } #endif // !_i_isset -#if !defined _i_no_clone +#if !defined i_no_clone STC_INLINE void _cx_memb(_copy)(_cx_self *self, const _cx_self* other) { if (self->table == other->table) return; @@ -150,9 +150,9 @@ _cx_memb(_value_clone)(_cx_value _val) { _i_MAP_ONLY( _val.second = i_valclone(_val.second); ) return _val; } -#endif // !_i_no_clone +#endif // !i_no_clone -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_INLINE _cx_result _cx_memb(_emplace)(_cx_self* self, _cx_rawkey rkey _i_MAP_ONLY(, i_valraw rmapped)) { _cx_result _res = _cx_memb(_insert_entry_)(self, rkey); @@ -162,7 +162,7 @@ _cx_memb(_emplace)(_cx_self* self, _cx_rawkey rkey _i_MAP_ONLY(, i_valraw rmappe } return _res; } -#endif // !_i_no_emplace +#endif // !i_no_emplace STC_INLINE _cx_raw _cx_memb(_value_toraw)(const _cx_value* val) { @@ -320,7 +320,7 @@ STC_DEF void _cx_memb(_clear)(_cx_self* self) { return _res; } - #if !defined _i_no_emplace + #if !defined i_no_emplace STC_DEF _cx_result _cx_memb(_emplace_or_assign)(_cx_self* self, _cx_rawkey rkey, i_valraw rmapped) { _cx_result _res = _cx_memb(_insert_entry_)(self, rkey); @@ -331,7 +331,7 @@ STC_DEF void _cx_memb(_clear)(_cx_self* self) { _res.ref->second = i_valfrom(rmapped); return _res; } - #endif // !_i_no_emplace + #endif // !i_no_emplace #endif // !_i_isset STC_DEF chash_bucket_t @@ -366,7 +366,7 @@ _cx_memb(_insert_entry_)(_cx_self* self, _cx_rawkey rkey) { return res; } -#if !defined _i_no_clone +#if !defined i_no_clone STC_DEF _cx_self _cx_memb(_clone)(_cx_self m) { if (m.table) { diff --git a/include/stc/cpque.h b/include/stc/cpque.h index ba83474b..996e1a22 100644 --- a/include/stc/cpque.h +++ b/include/stc/cpque.h @@ -90,7 +90,7 @@ STC_INLINE const _cx_value* _cx_memb(_top)(const _cx_self* self) STC_INLINE void _cx_memb(_pop)(_cx_self* self) { assert(!_cx_memb(_empty)(self)); _cx_memb(_erase_at)(self, 0); } -#if !defined _i_no_clone +#if !defined i_no_clone STC_API _cx_self _cx_memb(_clone)(_cx_self q); STC_INLINE void _cx_memb(_copy)(_cx_self *self, const _cx_self* other) { @@ -100,12 +100,12 @@ STC_INLINE void _cx_memb(_copy)(_cx_self *self, const _cx_self* other) { } STC_INLINE i_key _cx_memb(_value_clone)(_cx_value val) { return i_keyclone(val); } -#endif // !_i_no_clone +#endif // !i_no_clone -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_INLINE void _cx_memb(_emplace)(_cx_self* self, _cx_raw raw) { _cx_memb(_push)(self, i_keyfrom(raw)); } -#endif // !_i_no_emplace +#endif // !i_no_emplace /* -------------------------- IMPLEMENTATION ------------------------- */ #if defined(i_implement) @@ -127,7 +127,7 @@ _cx_memb(_make_heap)(_cx_self* self) { _cx_memb(_sift_down_)(self, k, n); } -#if !defined _i_no_clone +#if !defined i_no_clone STC_DEF _cx_self _cx_memb(_clone)(_cx_self q) { _cx_self out = _cx_memb(_with_capacity)(q._len); for (; out._len < out._cap; ++q.data) diff --git a/include/stc/csmap.h b/include/stc/csmap.h index 6fba2e65..b503fc9b 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -97,12 +97,12 @@ typedef _i_SET_ONLY( i_keyraw ) _i_MAP_ONLY( struct { i_keyraw first; i_valraw second; } ) _cx_raw; -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_API _cx_result _cx_memb(_emplace)(_cx_self* self, _cx_rawkey rkey _i_MAP_ONLY(, i_valraw rmapped)); -#endif // !_i_no_emplace -#if !defined _i_no_clone +#endif // !i_no_emplace +#if !defined i_no_clone STC_API _cx_self _cx_memb(_clone)(_cx_self tree); -#endif // !_i_no_clone +#endif // !i_no_clone STC_API _cx_self _cx_memb(_init)(void); STC_API _cx_result _cx_memb(_insert)(_cx_self* self, i_key key _i_MAP_ONLY(, i_val mapped)); STC_API _cx_result _cx_memb(_push)(_cx_self* self, _cx_value _val); @@ -161,7 +161,7 @@ _cx_memb(_value_drop)(_cx_value* val) { _i_MAP_ONLY( i_valdrop((&val->second)); ) } -#if !defined _i_no_clone +#if !defined i_no_clone STC_INLINE _cx_value _cx_memb(_value_clone)(_cx_value _val) { *_i_keyref(&_val) = i_keyclone((*_i_keyref(&_val))); @@ -182,10 +182,10 @@ _cx_memb(_shrink_to_fit)(_cx_self *self) { _cx_self tmp = _cx_memb(_clone)(*self); _cx_memb(_drop)(self); *self = tmp; } -#endif // !_i_no_clone +#endif // !i_no_clone #ifndef _i_isset - #if !defined _i_no_emplace + #if !defined i_no_emplace STC_API _cx_result _cx_memb(_emplace_or_assign)(_cx_self* self, _cx_rawkey rkey, i_valraw rmapped); #endif STC_API _cx_result _cx_memb(_insert_or_assign)(_cx_self* self, i_key key, i_val mapped); @@ -316,7 +316,7 @@ _cx_memb(_push)(_cx_self* self, _cx_value _val) { return res; } - #if !defined _i_no_emplace + #if !defined i_no_emplace STC_DEF _cx_result _cx_memb(_emplace_or_assign)(_cx_self* self, _cx_rawkey rkey, i_valraw rmapped) { _cx_result res = _cx_memb(_insert_entry_)(self, rkey); @@ -329,7 +329,7 @@ _cx_memb(_push)(_cx_self* self, _cx_value _val) { } return res; } - #endif // !_i_no_emplace + #endif // !i_no_emplace #endif // !_i_isset STC_DEF _cx_value* @@ -523,7 +523,7 @@ _cx_memb(_erase_range)(_cx_self* self, _cx_iter it1, _cx_iter it2) { } } -#if !defined _i_no_clone +#if !defined i_no_clone static i_size _cx_memb(_clone_r_)(_cx_self* self, _cx_node* src, i_size sn) { if (sn == 0) @@ -543,9 +543,9 @@ _cx_memb(_clone)(_cx_self tree) { clone.size = tree.size; return clone; } -#endif // !_i_no_clone +#endif // !i_no_clone -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_DEF _cx_result _cx_memb(_emplace)(_cx_self* self, _cx_rawkey rkey _i_MAP_ONLY(, i_valraw rmapped)) { _cx_result res = _cx_memb(_insert_entry_)(self, rkey); @@ -555,7 +555,7 @@ _cx_memb(_emplace)(_cx_self* self, _cx_rawkey rkey _i_MAP_ONLY(, i_valraw rmappe } return res; } -#endif // _i_no_emplace +#endif // i_no_emplace static void _cx_memb(_drop_r_)(_cx_node* d, i_size tn) { diff --git a/include/stc/cstack.h b/include/stc/cstack.h index 7e46da86..7aacb076 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -35,7 +35,7 @@ #if !c_option(c_is_forward) #ifdef i_capacity - #define _i_no_clone + #define i_no_clone _cx_deftypes(_c_cstack_fixed, _cx_self, i_key, i_capacity); #else _cx_deftypes(_c_cstack_types, _cx_self, i_key); @@ -142,12 +142,12 @@ STC_INLINE const _cx_value* _cx_memb(_at)(const _cx_self* self, size_t idx) STC_INLINE _cx_value* _cx_memb(_at_mut)(_cx_self* self, size_t idx) { assert(idx < self->_len); return self->data + idx; } -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw) { return _cx_memb(_push)(self, i_keyfrom(raw)); } -#endif // !_i_no_emplace +#endif // !i_no_emplace -#if !defined _i_no_clone +#if !defined i_no_clone STC_INLINE _cx_self _cx_memb(_clone)(_cx_self v) { _cx_self out = {(_cx_value *)c_malloc(v._len*sizeof(_cx_value)), v._len, v._len}; if (!out.data) out._cap = 0; @@ -167,7 +167,7 @@ STC_INLINE i_key _cx_memb(_value_clone)(_cx_value val) STC_INLINE i_keyraw _cx_memb(_value_toraw)(const _cx_value* val) { return i_keyto(val); } -#endif // !_i_no_clone +#endif // !i_no_clone STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) { return c_init(_cx_iter){self->_len ? (_cx_value*)self->data : NULL, diff --git a/include/stc/cvec.h b/include/stc/cvec.h index 2f49ec34..d395444d 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -89,13 +89,13 @@ STC_API _cx_iter _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, STC_API _cx_iter _cx_memb(_insert_range)(_cx_self* self, _cx_value* pos, const _cx_value* p1, const _cx_value* p2); STC_API _cx_iter _cx_memb(_insert_uninit)(_cx_self* self, _cx_value* pos, const size_t n); -#if !defined _i_no_cmp +#if !defined i_no_cmp STC_API int _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y); STC_API _cx_iter _cx_memb(_find_in)(_cx_iter it1, _cx_iter it2, _cx_raw raw); STC_API _cx_iter _cx_memb(_binary_search_in)(_cx_iter it1, _cx_iter it2, _cx_raw raw, _cx_iter* lower_bound); #endif -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_API _cx_iter _cx_memb(_emplace_range)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, const _cx_raw* p2); STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw) @@ -110,9 +110,9 @@ STC_INLINE _cx_iter _cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, _cx_raw raw) { return _cx_memb(_emplace_range)(self, _it_ptr(it), &raw, &raw + 1); } -#endif // !_i_no_emplace +#endif // !i_no_emplace -#if !defined _i_no_clone +#if !defined i_no_clone STC_API _cx_self _cx_memb(_clone)(_cx_self cx); STC_API _cx_iter _cx_memb(_copy_range)(_cx_self* self, _cx_value* pos, const _cx_value* p1, const _cx_value* p2); @@ -124,7 +124,7 @@ STC_INLINE void _cx_memb(_copy)(_cx_self* self, const _cx_self* other) { _cx_memb(_copy_range)(self, self->data, other->data, other->data + cvec_rep_(other)->size); } -#endif // !_i_no_clone +#endif // !i_no_clone STC_INLINE size_t _cx_memb(_size)(const _cx_self* cx) { return cvec_rep_(cx)->size; } STC_INLINE size_t _cx_memb(_capacity)(const _cx_self* cx) { return cvec_rep_(cx)->cap; } @@ -213,7 +213,7 @@ STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, intptr_t n) STC_INLINE size_t _cx_memb(_index)(const _cx_self* cx, _cx_iter it) { return it.ref - cx->data; } -#if !defined _i_no_cmp +#if !defined i_no_cmp STC_INLINE _cx_iter _cx_memb(_find)(const _cx_self* self, _cx_raw raw) { @@ -370,7 +370,7 @@ _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, _cx_value* p2) { return c_init(_cx_iter){p2 == end ? NULL : p1, end - len}; } -#if !defined _i_no_clone +#if !defined i_no_clone STC_DEF _cx_self _cx_memb(_clone)(_cx_self cx) { const size_t len = cvec_rep_(&cx)->size; @@ -388,9 +388,9 @@ _cx_memb(_copy_range)(_cx_self* self, _cx_value* pos, *p++ = i_keyclone((*p1)); return it; } -#endif // !_i_no_clone +#endif // !i_no_clone -#if !defined _i_no_emplace +#if !defined i_no_emplace STC_DEF _cx_iter _cx_memb(_emplace_range)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, const _cx_raw* p2) { @@ -400,9 +400,9 @@ _cx_memb(_emplace_range)(_cx_self* self, _cx_value* pos, *p++ = i_keyfrom((*p1)); return it; } -#endif // !_i_no_emplace +#endif // !i_no_emplace -#if !defined _i_no_cmp +#if !defined i_no_cmp STC_DEF _cx_iter _cx_memb(_find_in)(_cx_iter i1, _cx_iter i2, _cx_raw raw) { const _cx_value* p2 = _it2_ptr(i1, i2); diff --git a/include/stc/template.h b/include/stc/template.h index e9fbcfba..95a0871f 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -90,10 +90,13 @@ #endif #if c_option(c_no_cmp) - #define _i_no_cmp + #define i_no_cmp #endif #if c_option(c_no_hash) - #define _i_no_hash + #define i_no_hash +#endif +#if c_option(c_no_emplace) + #define i_no_emplace #endif #if defined i_key_str @@ -115,10 +118,8 @@ #elif defined i_keyboxed #define i_keyclass i_keyboxed #define i_rawclass c_paste(i_keyboxed, _raw) - #if !c_option(c_no_from) - #define i_keyfrom c_paste(i_keyboxed, _from) - #endif - #if !defined _i_no_hash + #define i_keyfrom c_paste(i_keyboxed, _from) + #if !defined i_no_hash #define i_eq c_paste(i_keyboxed, _raw_eq) #endif #endif @@ -143,10 +144,10 @@ #endif #ifdef i_rawclass - #if !defined i_cmp && !defined _i_no_cmp + #if !defined i_cmp && !defined i_no_cmp #define i_cmp c_paste(i_keyraw, _cmp) #endif - #if !defined i_hash && !defined _i_no_hash + #if !defined i_hash && !defined i_no_hash #define i_hash c_paste(i_keyraw, _hash) #endif #endif @@ -165,7 +166,7 @@ #define i_tag i_key #endif #if c_option(c_no_clone) || (!defined i_keyclone && (defined i_keydrop || defined i_keyraw)) - #define _i_no_clone + #define i_no_clone #endif #ifndef i_keyraw #define i_keyraw i_key @@ -220,9 +221,7 @@ #elif defined i_valboxed #define i_valclass i_valboxed #define i_valraw c_paste(i_valboxed, _raw) - #if !c_option(c_no_from) - #define i_valfrom c_paste(i_valboxed, _from) - #endif + #define i_valfrom c_paste(i_valboxed, _from) #endif #ifdef i_valclass @@ -243,7 +242,7 @@ #endif #if !defined i_valclone && (defined i_valdrop || defined i_valraw) - #define _i_no_clone + #define i_no_clone #endif #ifndef i_valraw #define i_valraw i_val @@ -272,7 +271,7 @@ #define i_valraw i_keyraw #endif #ifndef _i_has_from - #define _i_no_emplace + #define i_no_emplace #endif #else // ============================================================ @@ -316,12 +315,13 @@ #undef i_static #undef i_extern -#undef _i_expandby +#undef i_no_cmp +#undef i_no_hash +#undef i_no_clone +#undef i_no_emplace + #undef _i_prefix +#undef _i_expandby #undef _i_has_from -#undef _i_no_cmp -#undef _i_no_hash -#undef _i_no_clone -#undef _i_no_emplace #undef _i_template #endif |
