summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/stc/cdeq.h36
-rw-r--r--include/stc/cvec.h56
2 files changed, 47 insertions, 45 deletions
diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h
index ef6c9f26..4bef2f38 100644
--- a/include/stc/cdeq.h
+++ b/include/stc/cdeq.h
@@ -51,8 +51,8 @@ STC_API void _cx_memb(_shrink_to_fit)(_cx_self *self);
#if !defined _i_queue
#if !defined _i_no_emplace
-STC_API _cx_iter _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_raw* p1, const _cx_raw* p2);
+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
#if !c_option(c_no_cmp)
@@ -61,8 +61,8 @@ STC_API int _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value
#endif
STC_API _cx_value* _cx_memb(_push_front)(_cx_self* self, i_key value);
STC_API _cx_iter _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, _cx_value* p2);
-STC_API _cx_iter _cx_memb(_insert_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2);
+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
@@ -72,13 +72,13 @@ STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw)
#if !defined _i_no_clone
#if !defined _i_queue
-STC_API _cx_iter _cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
+STC_API _cx_iter _cx_memb(_copy_range)(_cx_self* self, _cx_value* pos,
const _cx_value* p1, const _cx_value* p2);
STC_INLINE void _cx_memb(_copy)(_cx_self *self, const _cx_self* other) {
if (self->data == other->data) return;
_cx_memb(_clear)(self);
- _cx_memb(_copy_range_p)(self, self->data, other->data,
+ _cx_memb(_copy_range)(self, self->data, other->data,
other->data + cdeq_rep_(other)->size);
}
#endif // !_i_queue
@@ -116,15 +116,15 @@ STC_INLINE _cx_value* _cx_memb(_push_back)(_cx_self* self, i_key value) {
}
STC_INLINE _cx_iter
_cx_memb(_insert)(_cx_self* self, const size_t idx, i_key value) {
- return _cx_memb(_insert_range_p)(self, self->data + idx, &value, &value + 1);
+ return _cx_memb(_insert_range)(self, self->data + idx, &value, &value + 1);
}
STC_INLINE _cx_iter
_cx_memb(_insert_n)(_cx_self* self, const size_t idx, const _cx_value arr[], const size_t n) {
- return _cx_memb(_insert_range_p)(self, self->data + idx, arr, arr + n);
+ return _cx_memb(_insert_range)(self, self->data + idx, arr, arr + n);
}
STC_INLINE _cx_iter
_cx_memb(_insert_at)(_cx_self* self, _cx_iter it, i_key value) {
- return _cx_memb(_insert_range_p)(self, it.ref, &value, &value + 1);
+ return _cx_memb(_insert_range)(self, it.ref, &value, &value + 1);
}
STC_INLINE _cx_iter
@@ -167,11 +167,11 @@ STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, _cx_raw 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);
+ return _cx_memb(_emplace_range)(self, self->data + idx, arr, arr + n);
}
STC_INLINE _cx_iter
_cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, _cx_raw raw) {
- return _cx_memb(_emplace_range_p)(self, (it.ref ? it.ref : it.end), &raw, &raw + 1);
+ return _cx_memb(_emplace_range)(self, (it.ref ? it.ref : it.end), &raw, &raw + 1);
}
#endif // !_i_no_emplace
@@ -352,7 +352,7 @@ _cx_memb(_expand_left_half_)(_cx_self* self, const size_t idx, const size_t n) {
}
static _cx_iter
-_cx_memb(_insert_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n) {
+_cx_memb(_insert_uninit)(_cx_self* self, _cx_value* pos, const size_t n) {
struct cdeq_rep* r = cdeq_rep_(self);
if (n) {
if (!pos) pos = self->data + r->size;
@@ -380,9 +380,9 @@ _cx_memb(_push_front)(_cx_self* self, i_key value) {
}
STC_DEF _cx_iter
-_cx_memb(_insert_range_p)(_cx_self* self, _cx_value* pos,
+_cx_memb(_insert_range)(_cx_self* self, _cx_value* pos,
const _cx_value* p1, const _cx_value* p2) {
- _cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
+ _cx_iter it = _cx_memb(_insert_uninit)(self, pos, p2 - p1);
if (it.ref)
memcpy(it.ref, p1, (p2 - p1)*sizeof *p1);
return it;
@@ -403,8 +403,8 @@ _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, _cx_value* p2) {
#if !defined _i_no_emplace
STC_DEF _cx_iter
-_cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, const _cx_raw* p2) {
- _cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
+_cx_memb(_emplace_range)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, const _cx_raw* p2) {
+ _cx_iter it = _cx_memb(_insert_uninit)(self, pos, p2 - p1);
if (it.ref)
for (_cx_iter j = it; p1 != p2; ++p1)
*j.ref++ = i_keyfrom((*p1));
@@ -414,9 +414,9 @@ _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, co
#if !defined _i_no_clone
STC_DEF _cx_iter
-_cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
+_cx_memb(_copy_range)(_cx_self* self, _cx_value* pos,
const _cx_value* p1, const _cx_value* p2) {
- _cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
+ _cx_iter it = _cx_memb(_insert_uninit)(self, pos, p2 - p1);
if (it.ref) for (_cx_iter j; p1 != p2; ++p1)
*j.ref++ = i_keyclone((*p1));
return it;
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index a7828708..c734abb6 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -84,9 +84,9 @@ STC_API bool _cx_memb(_reserve)(_cx_self* self, size_t cap);
STC_API bool _cx_memb(_resize)(_cx_self* self, size_t size, i_key null);
STC_API _cx_value* _cx_memb(_push)(_cx_self* self, i_key value);
STC_API _cx_iter _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, _cx_value* p2);
-STC_API _cx_iter _cx_memb(_insert_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2);
-STC_API _cx_iter _cx_memb(_insert_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n);
+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 !c_option(c_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);
@@ -94,33 +94,33 @@ STC_API _cx_iter _cx_memb(_binary_search_in)(_cx_iter it1, _cx_iter it2,
#endif
#if !defined _i_no_emplace
-STC_API _cx_iter _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_raw* p1, const _cx_raw* p2);
+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)
{ return _cx_memb(_push)(self, i_keyfrom(raw)); }
STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, _cx_raw raw)
{ return _cx_memb(_push)(self, i_keyfrom(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);
+ return _cx_memb(_emplace_range)(self, self->data + idx, arr, arr + n);
}
STC_INLINE _cx_iter
_cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, _cx_raw raw) {
- return _cx_memb(_emplace_range_p)(self, (it.ref ? it.ref : it.end), &raw, &raw + 1);
+ return _cx_memb(_emplace_range)(self, (it.ref ? it.ref : it.end), &raw, &raw + 1);
}
#endif // !_i_no_emplace
#if !defined _i_no_clone
STC_API _cx_self _cx_memb(_clone)(_cx_self cx);
-STC_API _cx_iter _cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2);
+STC_API _cx_iter _cx_memb(_copy_range)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2);
STC_INLINE i_key _cx_memb(_value_clone)(_cx_value val)
{ return i_keyclone(val); }
STC_INLINE void _cx_memb(_copy)(_cx_self* self, const _cx_self* other) {
if (self->data == other->data) return;
_cx_memb(_clear)(self);
- _cx_memb(_copy_range_p)(self, self->data, other->data,
- other->data + cvec_rep_(other)->size);
+ _cx_memb(_copy_range)(self, self->data, other->data,
+ other->data + cvec_rep_(other)->size);
}
#endif // !_i_no_clone
@@ -160,15 +160,15 @@ _cx_memb(_shrink_to_fit)(_cx_self* self) {
STC_INLINE _cx_iter
_cx_memb(_insert)(_cx_self* self, const size_t idx, i_key value) {
- return _cx_memb(_insert_range_p)(self, self->data + idx, &value, &value + 1);
+ return _cx_memb(_insert_range)(self, self->data + idx, &value, &value + 1);
}
STC_INLINE _cx_iter
_cx_memb(_insert_n)(_cx_self* self, const size_t idx, const _cx_value arr[], const size_t n) {
- return _cx_memb(_insert_range_p)(self, self->data + idx, arr, arr + n);
+ return _cx_memb(_insert_range)(self, self->data + idx, arr, arr + n);
}
STC_INLINE _cx_iter
_cx_memb(_insert_at)(_cx_self* self, _cx_iter it, i_key value) {
- return _cx_memb(_insert_range_p)(self, it.ref, &value, &value + 1);
+ return _cx_memb(_insert_range)(self, it.ref, &value, &value + 1);
}
STC_INLINE _cx_iter
@@ -291,7 +291,8 @@ _cx_memb(_reserve)(_cx_self* self, const size_t cap) {
const size_t len = rep->size;
if (cap > rep->cap || (cap && cap == len)) {
rep = (struct cvec_rep*) c_realloc(rep->cap ? rep : NULL,
- offsetof(struct cvec_rep, data) + cap*sizeof(i_key));
+ offsetof(struct cvec_rep, data)
+ + cap*sizeof(i_key));
if (!rep)
return false;
self->data = (_cx_value*) rep->data;
@@ -328,7 +329,7 @@ _cx_memb(_push)(_cx_self* self, i_key value) {
}
STC_DEF _cx_iter
-_cx_memb(_insert_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n) {
+_cx_memb(_insert_uninit)(_cx_self* self, _cx_value* pos, const size_t n) {
struct cvec_rep* r = cvec_rep_(self);
if (n) {
if (!pos) pos = self->data + r->size;
@@ -346,9 +347,9 @@ _cx_memb(_insert_uninit_p)(_cx_self* self, _cx_value* pos, const size_t n) {
}
STC_DEF _cx_iter
-_cx_memb(_insert_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2) {
- _cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
+_cx_memb(_insert_range)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2) {
+ _cx_iter it = _cx_memb(_insert_uninit)(self, pos, p2 - p1);
if (it.ref)
memcpy(it.ref, p1, (p2 - p1)*sizeof *p1);
return it;
@@ -373,14 +374,14 @@ _cx_memb(_clone)(_cx_self cx) {
const size_t len = cvec_rep_(&cx)->size;
_cx_self out = _cx_memb(_with_capacity)(len);
if (cvec_rep_(&out)->cap)
- _cx_memb(_copy_range_p)(&out, out.data, cx.data, cx.data + len);
+ _cx_memb(_copy_range)(&out, out.data, cx.data, cx.data + len);
return out;
}
STC_DEF _cx_iter
-_cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2) {
- _cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
+_cx_memb(_copy_range)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2) {
+ _cx_iter it = _cx_memb(_insert_uninit)(self, pos, p2 - p1);
if (it.ref)
for (_cx_iter j = it; p1 != p2; ++p1)
*j.ref++ = i_keyclone((*p1));
@@ -390,9 +391,9 @@ _cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
#if !defined _i_no_emplace
STC_DEF _cx_iter
-_cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_raw* p1, const _cx_raw* p2) {
- _cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
+_cx_memb(_emplace_range)(_cx_self* self, _cx_value* pos,
+ const _cx_raw* p1, const _cx_raw* p2) {
+ _cx_iter it = _cx_memb(_insert_uninit)(self, pos, p2 - p1);
if (it.ref)
for (_cx_iter j = it; p1 != p2; ++p1)
*j.ref++ = i_keyfrom((*p1));
@@ -413,7 +414,8 @@ _cx_memb(_find_in)(_cx_iter i1, _cx_iter i2, _cx_raw raw) {
}
STC_DEF _cx_iter
-_cx_memb(_binary_search_in)(_cx_iter i1, _cx_iter i2, const _cx_raw raw, _cx_iter* lower_bound) {
+_cx_memb(_binary_search_in)(_cx_iter i1, _cx_iter i2, const _cx_raw raw,
+ _cx_iter* lower_bound) {
const _cx_value* p2 = i2.ref ? i2.ref : i2.end;
_cx_iter mid = i1;
while (i1.ref != p2) {