4#if !defined(SKIP_INCLUDES)
12 #if !defined DC_PLACEHOLDERS
21 #define ITEM_DELETE item_delete
23 #define ITEM_CLONE item_clone
25 #define ITEM_DEBUG item_debug
29#if !defined ITEM_DELETE
30 #define ITEM_DELETE DC_NO_DELETE
33#if !defined ITEM_CLONE
34 #define ITEM_CLONE DC_COPY_CLONE
37#if !defined ITEM_DEBUG
38 #define ITEM_DEBUG DC_DEFAULT_DEBUG
44#define ITEM_VECTORS NS(NAME, item_vectors)
46#pragma push_macro("ALLOC")
47#pragma push_macro("ITEM")
48#pragma push_macro("ITEM_CLONE")
49#pragma push_macro("ITEM_DELETE")
52#define INTERNAL_NAME ITEM_VECTORS
55#pragma pop_macro("ALLOC")
56#pragma pop_macro("ITEM")
57#pragma pop_macro("ITEM_CLONE")
58#pragma pop_macro("ITEM_DELETE")
67#define INVARIANT_CHECK(self) DC_ASSUME(self);
114 size_t const total_size = front_size + back_size;
126 if (front_size > back_size) {
127 source = &self->front;
128 target = &self->back;
129 source_size = front_size;
130 target_size = back_size;
132 source = &self->back;
133 target = &self->front;
134 source_size = back_size;
135 target_size = front_size;
138 size_t to_move = (source_size - target_size) / 2;
140 if (target_size == 0 && source_size > 0) {
141 to_move = (source_size + 1) / 2;
226#define ITER NS(SELF, iter)
242 size_t const total_size = front_size + back_size;
244 if (iter->pos < total_size) {
246 if (iter->pos < front_size) {
266 return (
ITER){.deque = self,
273#define ITER_CONST NS(SELF, iter_const)
289 size_t const total_size = front_size + back_size;
291 if (iter->pos < total_size) {
293 if (iter->pos < front_size) {
345#undef INVARIANT_CHECK
static DC_PUBLIC void debug(SELF const *self, dc_debug_fmt fmt, FILE *stream)
static DC_PUBLIC VALUE const * try_read(SELF const *self, INDEX index)
#define INVARIANT_CHECK(self)
static DC_PUBLIC IV_PAIR next(ITER *iter)
static DC_PUBLIC bool empty(ITER const *iter)
static DC_PUBLIC VALUE const * read(SELF const *self, INDEX index)
static DC_PUBLIC VALUE * write(SELF *self, INDEX index)
static DC_PUBLIC bool empty_item(IV_PAIR const *item)
static DC_PUBLIC ITER get_iter(SELF *self)
static DC_PUBLIC ITER_CONST get_iter_const(SELF const *self)
static DC_PUBLIC size_t size(SELF const *self)
static DC_PUBLIC SELF clone(SELF const *self)
static DC_PUBLIC ITEM * try_write_from_back(SELF *self, size_t index)
static DC_PUBLIC ITEM pop_front(SELF *self)
static DC_PUBLIC ITEM const * try_read_from_front(SELF const *self, size_t index)
static DC_PUBLIC ITEM * try_write_from_front(SELF *self, size_t index)
static DC_PUBLIC void push_front(SELF *self, ITEM item)
static DC_PUBLIC ITEM const * try_read_from_back(SELF const *self, size_t index)
static DC_PUBLIC void push_back(SELF *self, ITEM item)
static DC_PUBLIC ITEM pop_back(SELF *self)
static DC_PUBLIC void rebalance(SELF *self)
static DC_PUBLIC SELF new_with_capacity(size_t front_and_back_capacity, ref alloc_ref)
#define DC_TRAIT_QUEUE(SELF)
static DC_PUBLIC ITEM * push(SELF *self, ITEM item)
static DC_PUBLIC ITEM pop(SELF *self)
static DC_PUBLIC void transfer_reverse(SELF *source, SELF *target, size_t to_move)
#define TEMPLATE_ERROR(...)
With the user provided name, even in nested templates.
static DC_PUBLIC void dc_debug_fmt_print(dc_debug_fmt fmt, FILE *stream, const char *format,...)
static DC_PUBLIC dc_debug_fmt dc_debug_fmt_scope_end(dc_debug_fmt fmt)
static DC_PUBLIC dc_debug_fmt dc_debug_fmt_scope_begin(dc_debug_fmt fmt)
static DC_PUBLIC dc_gdb_marker dc_gdb_marker_new()
static DC_PUBLIC void mutation_tracker_mutate(mutation_tracker *self)
static DC_PUBLIC void mutation_version_check(mutation_version const *self)
static DC_PUBLIC mutation_tracker mutation_tracker_new()
static DC_PUBLIC mutation_version mutation_tracker_get(mutation_tracker const *self)
#define DC_EXPAND_STRING(NAME)
#define DC_UNREACHABLE(...)
#define DC_ASSUME(expr,...)
static bool _dc_deque_rebalance_policy(size_t total_size, size_t front_size, size_t back_size)
mutation_tracker iterator_invalidation_tracker
dc_gdb_marker derive_c_deque
Debug format helpers for debug printin data structures.
A queue comprised of an extendable circular buffer.
tracks a specific version of a value, so that this can be compared later to check modification For ex...
static DC_PUBLIC FILE * stream(SELF *self)