diff options
| author | Tyge Løvset <[email protected]> | 2022-04-15 22:08:12 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-04-15 22:08:12 +0200 |
| commit | fa261ddd307de9b7bb2965a066fd83b66d8d83a7 (patch) | |
| tree | f89c186fdaaedb8ab34c223e1a75f4d25db612ab | |
| parent | 99acd2149f3f8996249b3ef82f7490dd098783d7 (diff) | |
| download | STC-modified-fa261ddd307de9b7bb2965a066fd83b66d8d83a7.tar.gz STC-modified-fa261ddd307de9b7bb2965a066fd83b66d8d83a7.zip | |
Updated README.md docs on template args! Reverted to put() as alias for insert_or_assign() for maps. Reverted/added push_back()/emplace_back()/pop_back() to cstack.
| -rw-r--r-- | README.md | 17 | ||||
| -rw-r--r-- | docs/cdeq_api.md | 2 | ||||
| -rw-r--r-- | docs/cmap_api.md | 2 | ||||
| -rw-r--r-- | docs/cset_api.md | 1 | ||||
| -rw-r--r-- | docs/csmap_api.md | 2 | ||||
| -rw-r--r-- | docs/csset_api.md | 1 | ||||
| -rw-r--r-- | docs/cstack_api.md | 3 | ||||
| -rw-r--r-- | docs/cvec_api.md | 5 | ||||
| -rw-r--r-- | include/stc/alt/csmap.h | 2 | ||||
| -rw-r--r-- | include/stc/cdeq.h | 15 | ||||
| -rw-r--r-- | include/stc/clist.h | 2 | ||||
| -rw-r--r-- | include/stc/cmap.h | 15 | ||||
| -rw-r--r-- | include/stc/cqueue.h | 2 | ||||
| -rw-r--r-- | include/stc/csmap.h | 14 | ||||
| -rw-r--r-- | include/stc/cstack.h | 7 | ||||
| -rw-r--r-- | include/stc/cvec.h | 6 |
16 files changed, 44 insertions, 52 deletions
@@ -43,9 +43,9 @@ which by the compiler is seen as different code because of macro name substituti - [***cvec*** - **std::vector** alike type](docs/cvec_api.md) Others: -- [***threads*** - Mimic **C11-threads** (by Marcus Geelnard)](include/threads.h) - [***crandom*** - A novel very fast *PRNG* named **stc64**](docs/crandom_api.md) - [***coption*** - Command line options scanner](docs/coption_api.md) +- [***threads*** - Mimic **C11-threads** (by Marcus Geelnard)](include/threads.h) Highlights ---------- @@ -290,15 +290,16 @@ Val: - `i_valto` - Convertion func `i_val *` => `i_valraw`. Special: -- `i_key_str` - Define key type `cstr` and container i_tag = `str`. It binds type convertion from/to const char*, and the cmp, eq, hash, and keydrop functions. -- `i_key_arcbox TYPE` - Define key type where TYPE is a smart pointer `carc` or `cbox`. I.e. not to be used when defining carc/cbox types themselves. -- `i_key_bind TYPE` - General version of the two above - will auto-bind to standard named functions based on TYPE. Use for elements where the following functions are defined: *TYPE_cmp*, *TYPE_clone*, *TYPE_drop*, *TYPE_hash*, and *TYPE_eq*. Only the functions required by the particular container needs to be defined. e.g. **cmap** and **cset** are the only types that require *TYPE_hash* and *TYPE_eq* to be defined. *TYPE_cmp* and *TYPE_clone* are not required if `i_opt c_no_cmp|c_no_clone` is defined. *TYPE_drop* is always required when using `_bind`. -- `i_val_str`, `i_val_bind`, `i_val_arcbox` - Same as for key. +- `i_key_str` - Define key type `cstr` and container i_tag = `str`. It binds type convertion from/to `const char*`, and the ***cmp***, ***eq***, ***hash***, and ***keydrop*** functions. +- `i_key_arcbox TYPE` - Define container key type where TYPE is a smart pointer **carc** or **cbox**. NB: not to be used when defining carc/cbox types themselves. +- `i_key_bind TYPE` - General version of the two above - will auto-bind to standard named functions: *TYPE_clone*, *TYPE_drop*, *TYPE_cmp*, *TYPE_eq*, *TYPE_hash*. Only functions required by the particular container need to be defined (*TYPE_drop* is always used). E.g., only **cmap** and **cset** uses *TYPE_hash* and *TYPE_eq*. And **cstack** does not use *TYPE_cmp*. *TYPE_clone* is not used if `#define i_opt c_no_clone` is specified. Likewise, *TYPE_cmp* is not used if `#define i_opt c_no_cmp` is specified. +- `i_keyraw RAWTYPE` - If defined along with `i_key_bind`, the two functions `TYPE TYPE_from(i_valraw)` and `RAWTYPE TYPE_toraw(TYPE*)` are expected instead of `TYPE TYPE_clone(TYPE)`. Cloning is done by `TYPE_from(TYPE_toraw(&val))`. Functions ***cmp***, ***eq*** and ***hash*** to be bound must have name/signature: `int RAWTYPE_cmp(const RAWTYPE*, const RAWTYPE*)`, and similar for *RAWTYPE_eq* and *RAWTYPE_hash*. +- `i_val_str`, `i_val_bind`, `i_val_arcbox` - Similar rules as for *key*. Notes: - For non-associative containers, `i_drop` and `i_from` may be defined instead of `i_valdrop` and `i_valfrom`. -- Instead of defining `i_cmp`, you may define `i_opt c_no_cmp` to disable methods using comparison. -- Instead of defining `i_*from`, you may define `i_opt c_no_clone` to disabled emplace and clone-functions. +- Instead of defining `i_cmp`, you may define `i_opt c_no_cmp` to disable searching and sorting functions. +- Instead of defining `i_*from`, you may define `i_opt c_no_clone` to disable emplace and clone-functions. - If a destructor `i_*drop` is defined, then either `i_*from` or `i_opt c_no_clone` must be defined. The *emplace* versus non-emplace container methods @@ -319,7 +320,7 @@ can easier lead to mistakes. | non-emplace: Move | emplace: Embedded copy | Container | |:---------------------------|:-----------------------------|:--------------------------------------------| | insert() | emplace() | cmap, csmap, cset, csset | -| insert_or_assign(), push() | emplace_or_assign() | cmap, csmap | +| insert_or_assign(), put() | emplace_or_assign() | cmap, csmap | | push() | emplace() | cqueue, cpque, cstack | | push_back(), push() | emplace_back() | cdeq, clist, cvec | | push_front() | emplace_front() | cdeq, clist | diff --git a/docs/cdeq_api.md b/docs/cdeq_api.md index 1bc70bfa..69a40986 100644 --- a/docs/cdeq_api.md +++ b/docs/cdeq_api.md @@ -51,7 +51,6 @@ cdeq_X_value* cdeq_X_emplace_front(cdeq_X* self, i_valraw raw); void cdeq_X_pop_front(cdeq_X* self); cdeq_X_value* cdeq_X_push_back(cdeq_X* self, i_val value); -cdeq_X_value* cdeq_X_push(cdeq_X* self, i_val value); // alias for push_back() cdeq_X_value* cdeq_X_emplace_back(cdeq_X* self, i_valraw raw); void cdeq_X_pop_back(cdeq_X* self); @@ -61,7 +60,6 @@ cdeq_X_iter cdeq_X_insert_at(cdeq_X* self, cdeq_X_iter it, i_val value); cdeq_X_iter cdeq_X_insert_range_p(cdeq_X* self, i_val* pos, const i_val* p1, const i_val* p2); -cdeq_X_iter cdeq_X_emplace(cdeq_X* self, size_t idx, i_valraw raw); cdeq_X_iter cdeq_X_emplace_n(cdeq_X* self, size_t idx, const i_valraw[] arr, size_t n); cdeq_X_iter cdeq_X_emplace_at(cdeq_X* self, cdeq_X_iter it, i_valraw raw); cdeq_X_iter cdeq_X_emplace_range(cdeq_X* self, cdeq_X_iter it, // will clone diff --git a/docs/cmap_api.md b/docs/cmap_api.md index ea0556b7..4c945a25 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -66,7 +66,7 @@ cmap_X_iter cmap_X_find(const cmap_X* self, i_keyraw rkey); cmap_X_result cmap_X_insert(cmap_X* self, i_key key, i_val mapped); // no change if key in map cmap_X_result cmap_X_insert_or_assign(cmap_X* self, i_key key, i_val mapped); // always update mapped -cmap_X_result cmap_X_push(cmap_X* self, i_key key, i_val mapped); // alias for insert_or_assign +cmap_X_result cmap_X_put(cmap_X* self, i_key key, i_val mapped); // alias for insert_or_assign cmap_X_result cmap_X_emplace(cmap_X* self, i_keyraw rkey, i_valraw rmapped); // no change if rkey in map cmap_X_result cmap_X_emplace_or_assign(cmap_X* self, i_keyraw rkey, i_valraw rmapped); // always update rmapped diff --git a/docs/cset_api.md b/docs/cset_api.md index a7970baf..4d97b94f 100644 --- a/docs/cset_api.md +++ b/docs/cset_api.md @@ -46,7 +46,6 @@ cset_X_value* cset_X_get_mut(cset_X* self, i_keyraw rkey); cset_X_iter cset_X_find(const cset_X* self, i_keyraw rkey);
cset_X_result cset_X_insert(cset_X* self, i_key key);
-cset_X_result cset_X_push(cset_X* self, i_key key); // alias for insert()
cset_X_result cset_X_emplace(cset_X* self, i_keyraw rkey);
size_t cset_X_erase(cset_X* self, i_keyraw rkey); // return 0 or 1
diff --git a/docs/csmap_api.md b/docs/csmap_api.md index 91818624..e6f5515c 100644 --- a/docs/csmap_api.md +++ b/docs/csmap_api.md @@ -62,7 +62,7 @@ csmap_X_value* csmap_X_back(const csmap_X* self); csmap_X_result csmap_X_insert(csmap_X* self, i_key key, i_val mapped); // no change if key in map csmap_X_result csmap_X_insert_or_assign(csmap_X* self, i_key key, i_val mapped); // always update mapped -csmap_X_result csmap_X_push(csmap_X* self, i_key key, i_val mapped); // alias for insert_or_assign() +csmap_X_result csmap_X_put(csmap_X* self, i_key key, i_val mapped); // alias for insert_or_assign() csmap_X_result csmap_X_emplace(csmap_X* self, i_keyraw rkey, i_valraw rmapped); // no change if rkey in map csmap_X_result csmap_X_emplace_or_assign(csmap_X* self, i_keyraw rkey, i_valraw rmapped); // always update rmapped diff --git a/docs/csset_api.md b/docs/csset_api.md index b1bad3bc..76b26eee 100644 --- a/docs/csset_api.md +++ b/docs/csset_api.md @@ -42,7 +42,6 @@ csset_X_value* csset_X_find_it(const csset_X* self, i_keyraw rkey, csset_X csset_X_iter csset_X_lower_bound(const csset_X* self, i_keyraw rkey); // find closest entry >= rkey
csset_X_result csset_X_insert(csset_X* self, i_key key);
-csset_X_result csset_X_push(csset_X* self, i_key key); // alias for insert()
csset_X_result csset_X_emplace(csset_X* self, i_keyraw rkey);
size_t csset_X_erase(csset_X* self, i_keyraw rkey);
diff --git a/docs/cstack_api.md b/docs/cstack_api.md index 634f9ee7..299ea1c6 100644 --- a/docs/cstack_api.md +++ b/docs/cstack_api.md @@ -42,8 +42,11 @@ const i_val* cstack_X_at(const cstack_X* self, size_t idx); i_val* cstack_X_push(cstack_X* self, i_val value); i_val* cstack_X_emplace(cstack_X* self, i_valraw raw); +i_val* cstack_X_push_back(cstack_X* self, i_val value); // alias for push() +i_val* cstack_X_emplace_back(cstack_X* self, i_valraw r); // alias for emplace() void cstack_X_pop(cstack_X* self); +void cstack_X_pop_back(cstack_X* self); // alias for pop() cstack_X_iter cstack_X_begin(const cstack_X* self); cstack_X_iter cstack_X_end(const cstack_X* self); diff --git a/docs/cvec_api.md b/docs/cvec_api.md index 9dcffdc7..e8669395 100644 --- a/docs/cvec_api.md +++ b/docs/cvec_api.md @@ -58,9 +58,11 @@ cvec_X_iter cvec_X_bsearch_in(cvec_X_iter i1, cvec_X_iter i2, i_valraw r cvec_X_value* cvec_X_front(const cvec_X* self); cvec_X_value* cvec_X_back(const cvec_X* self); -cvec_X_value* cvec_X_emplace_back(cvec_X* self, i_valraw raw); cvec_X_value* cvec_X_push_back(cvec_X* self, i_val value); +cvec_X_value* cvec_X_emplace_back(cvec_X* self, i_valraw raw); cvec_X_value* cvec_X_push(cvec_X* self, i_val value); // alias for push_back +cvec_X_value* cvec_X_emplace(cvec_X* self, i_valraw raw); // alias for emplace_back + void cvec_X_pop_back(cvec_X* self); void cvec_X_pop(cvec_X* self); // alias for pop_back @@ -70,7 +72,6 @@ cvec_X_iter cvec_X_insert_at(cvec_X* self, cvec_X_iter it, i_val value); cvec_X_iter cvec_X_insert_range_p(cvec_X* self, i_val* pos, const i_val* p1, const i_val* p2); -cvec_X_iter cvec_X_emplace(cvec_X* self, size_t idx, i_valraw raw); cvec_X_iter cvec_X_emplace_n(cvec_X* self, size_t idx, const i_valraw[] arr, size_t n); cvec_X_iter cvec_X_emplace_at(cvec_X* self, cvec_X_iter it, i_valraw raw); cvec_X_iter cvec_X_emplace_range(cvec_X* self, cvec_X_iter it, // will clone diff --git a/include/stc/alt/csmap.h b/include/stc/alt/csmap.h index a2200028..cb976801 100644 --- a/include/stc/alt/csmap.h +++ b/include/stc/alt/csmap.h @@ -148,7 +148,7 @@ int main(void) { } \
\
STC_INLINE _cx_result \
- _cx_memb(_push)(_cx_self* self, i_key key, i_val mapped) { \
+ _cx_memb(_put)(_cx_self* self, i_key key, i_val mapped) { \
return _cx_memb(_insert_or_assign)(self, key, mapped); \
} \
\
diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h index c510b3e0..e562eaee 100644 --- a/include/stc/cdeq.h +++ b/include/stc/cdeq.h @@ -46,7 +46,7 @@ STC_API _cx_self _cx_memb(_with_capacity)(const size_t n); STC_API bool _cx_memb(_reserve)(_cx_self* self, const size_t n);
STC_API void _cx_memb(_clear)(_cx_self* self);
STC_API void _cx_memb(_drop)(_cx_self* self);
-STC_API _cx_value* _cx_memb(_push)(_cx_self* self, i_val value);
+STC_API _cx_value* _cx_memb(_push_back)(_cx_self* self, i_val value);
STC_API void _cx_memb(_shrink_to_fit)(_cx_self *self);
#if !defined _i_queue
#if !defined _i_no_clone
@@ -72,7 +72,7 @@ STC_API _cx_iter _cx_memb(_insert_range_p)(_cx_self* self, _cx_value* pos STC_API _cx_self _cx_memb(_clone)(_cx_self cx);
#if !defined _i_no_emplace
STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, i_valraw raw)
- { return _cx_memb(_push)(self, i_valfrom(raw)); }
+ { return _cx_memb(_push_back)(self, i_valfrom(raw)); }
#endif
STC_INLINE i_val _cx_memb(_value_clone)(i_val val)
{ i_valraw r = i_valto((&val)); return i_valfrom(r); }
@@ -103,9 +103,6 @@ STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, intptr_t offs) #if !defined _i_queue
-STC_INLINE _cx_value* _cx_memb(_push_back)(_cx_self* self, i_val value)
- { return _cx_memb(_push)(self, value); }
-
STC_INLINE void _cx_memb(_pop_back)(_cx_self* self)
{ _cx_value* p = &self->data[--cdeq_rep_(self)->size]; i_valdrop(p); }
@@ -156,10 +153,6 @@ STC_INLINE _cx_value* _cx_memb(_emplace_front)(_cx_self* self, i_valraw raw) { }
STC_INLINE _cx_iter
-_cx_memb(_emplace)(_cx_self* self, const size_t idx, i_valraw raw) {
- return _cx_memb(_emplace_range_p)(self, self->data + idx, &raw, &raw + 1);
-}
-STC_INLINE _cx_iter
_cx_memb(_emplace_n)(_cx_self* self, const size_t idx, const _cx_raw arr[], const size_t n) {
return _cx_memb(_emplace_range_p)(self, self->data + idx, arr, arr + n);
}
@@ -295,8 +288,8 @@ _cx_memb(_reserve)(_cx_self* self, const size_t n) { return n <= sz || _cx_memb(_expand_right_half_)(self, sz, n - sz);
}
-STC_DEF _cx_value* // push back
-_cx_memb(_push)(_cx_self* self, i_val value) {
+STC_DEF _cx_value*
+_cx_memb(_push_back)(_cx_self* self, i_val value) {
struct cdeq_rep* r = cdeq_rep_(self);
if (_cdeq_nfront(self) + r->size == r->cap) {
_cx_memb(_expand_right_half_)(self, r->size, 1);
diff --git a/include/stc/clist.h b/include/stc/clist.h index 0ff59967..7b56bae4 100644 --- a/include/stc/clist.h +++ b/include/stc/clist.h @@ -125,8 +125,6 @@ STC_INLINE _cx_iter _cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, i_val #endif
#endif
-STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, i_val value)
- { return _cx_memb(_push_back)(self, value); }
STC_INLINE _cx_self _cx_memb(_init)(void) { return c_make(_cx_self){NULL}; }
STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, size_t n) { return true; }
STC_INLINE bool _cx_memb(_empty)(_cx_self cx) { return cx.last == NULL; }
diff --git a/include/stc/cmap.h b/include/stc/cmap.h index 707e26f0..340cba87 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -110,13 +110,15 @@ STC_INLINE bool _cx_memb(_contains)(const _cx_self* self, i_keyraw rkey) { return self->size && self->_hashx[_cx_memb(_bucket_)(self, &rkey).idx]; }
#ifndef _i_isset
- #if !defined _i_no_clone
- #if !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
- #endif
STC_API _cx_result _cx_memb(_insert_or_assign)(_cx_self* self, i_key _key, i_val _mapped);
+ STC_INLINE _cx_result
+ _cx_memb(_put)(_cx_self* self, i_key _key, i_val _mapped)
+ { return _cx_memb(_insert_or_assign)(self, _key, _mapped); }
+
STC_INLINE const _cx_mapped*
_cx_memb(_at)(const _cx_self* self, i_keyraw rkey) {
chash_bucket_t b = _cx_memb(_bucket_)(self, &rkey);
@@ -137,6 +139,7 @@ _cx_memb(_value_clone)(_cx_value _val) { _i_MAP_ONLY( i_valraw m = i_valto((&_val.second)); _val.second = i_valfrom(m); )
return _val;
}
+
#if !defined _i_no_emplace
STC_INLINE _cx_result
_cx_memb(_emplace)(_cx_self* self, i_keyraw rkey _i_MAP_ONLY(, i_valraw rmapped)) {
@@ -170,12 +173,6 @@ _cx_memb(_insert)(_cx_self* self, i_key _key _i_MAP_ONLY(, i_val _mapped)) { return _res;
}
-STC_INLINE _cx_result
-_cx_memb(_push)(_cx_self* self, i_key _key _i_MAP_ONLY(, i_val _mapped)) {
- return _i_SET_ONLY( _cx_memb(_insert)(self, _key) )
- _i_MAP_ONLY( _cx_memb(_insert_or_assign)(self, _key, _mapped) );
-}
-
STC_INLINE _cx_iter
_cx_memb(_find)(const _cx_self* self, i_keyraw rkey) {
_cx_size idx;
diff --git a/include/stc/cqueue.h b/include/stc/cqueue.h index 92cf4c49..18ac6d08 100644 --- a/include/stc/cqueue.h +++ b/include/stc/cqueue.h @@ -57,11 +57,13 @@ int main() { #define _i_prefix cqueue_
#endif
#define _i_queue
+#define _push_back _push
#define _emplace_back _emplace
#define _pop_front _pop
#include "cdeq.h"
+#undef _push_back
#undef _emplace_back
#undef _pop_front
#undef _i_queue
diff --git a/include/stc/csmap.h b/include/stc/csmap.h index af36db6c..be726723 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -156,24 +156,20 @@ _cx_memb(_value_drop)(_cx_value* val) { }
#ifndef _i_isset
- #if !defined _i_no_clone
- #if !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
- #endif
STC_API _cx_result _cx_memb(_insert_or_assign)(_cx_self* self, i_key key, i_val mapped);
+
+ STC_INLINE _cx_result
+ _cx_memb(_put)(_cx_self* self, i_key _key, i_val _mapped)
+ { return _cx_memb(_insert_or_assign)(self, _key, _mapped); }
STC_INLINE const _cx_mapped*
_cx_memb(_at)(const _cx_self* self, i_keyraw rkey)
{ _cx_iter it; return &_cx_memb(_find_it)(self, rkey, &it)->second; }
#endif
-STC_INLINE _cx_result
-_cx_memb(_push)(_cx_self* self, i_key _key _i_MAP_ONLY(, i_val _mapped)) {
- return _i_SET_ONLY( _cx_memb(_insert)(self, _key) )
- _i_MAP_ONLY( _cx_memb(_insert_or_assign)(self, _key, _mapped) );
-}
-
STC_INLINE _cx_iter
_cx_memb(_find)(const _cx_self* self, i_keyraw rkey) {
_cx_iter it;
diff --git a/include/stc/cstack.h b/include/stc/cstack.h index c5d77ed1..b3f5d5e2 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -87,8 +87,13 @@ STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, _cx_value val) { _cx_value* vp = self->data + self->size++;
*vp = val; return vp;
}
+STC_INLINE _cx_value* _cx_memb(_push_back)(_cx_self* self, _cx_value val)
+ { return _cx_memb(_push)(self, val); }
+
STC_INLINE void _cx_memb(_pop)(_cx_self* self)
{ _cx_value* p = &self->data[--self->size]; i_valdrop(p); }
+STC_INLINE void _cx_memb(_pop_back)(_cx_self* self)
+ { _cx_memb(_pop)(self); }
STC_INLINE const _cx_value* _cx_memb(_at)(const _cx_self* self, size_t idx)
{ assert(idx < self->size); return self->data + idx; }
@@ -97,6 +102,8 @@ STC_INLINE const _cx_value* _cx_memb(_at)(const _cx_self* self, size_t idx) #if !defined _i_no_emplace
STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw)
{ return _cx_memb(_push)(self, i_valfrom(raw)); }
+STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, _cx_raw raw)
+ { return _cx_memb(_push)(self, i_valfrom(raw)); }
#endif
STC_INLINE _cx_self _cx_memb(_clone)(_cx_self v) {
_cx_self out = {(_cx_value *) c_malloc(v.size*sizeof(_cx_value)), v.size, v.size};
diff --git a/include/stc/cvec.h b/include/stc/cvec.h index 79506a28..b671413b 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -109,10 +109,8 @@ STC_API _cx_iter _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* po const _cx_raw* p1, const _cx_raw* p2);
STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, i_valraw raw)
{ return _cx_memb(_push_back)(self, i_valfrom(raw)); }
-STC_INLINE _cx_iter
-_cx_memb(_emplace)(_cx_self* self, const size_t idx, _cx_raw val) {
- return _cx_memb(_emplace_range_p)(self, self->data + idx, &val, &val + 1);
-}
+STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, i_valraw raw)
+ { return _cx_memb(_push_back)(self, i_valfrom(raw)); }
STC_INLINE _cx_iter
_cx_memb(_emplace_n)(_cx_self* self, const size_t idx, const _cx_raw arr[], const size_t n) {
return _cx_memb(_emplace_range_p)(self, self->data + idx, arr, arr + n);
|
