4#if !defined(SKIP_INCLUDES)
12 #if !defined 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);
113 size_t const total_size = front_size + back_size;
124 if (front_size > back_size + 1) {
125 source = &self->front;
126 target = &self->back;
127 source_size = front_size;
128 target_size = back_size;
131 source = &self->back;
132 target = &self->front;
133 source_size = back_size;
134 target_size = front_size;
137 size_t const to_move = (source_size - target_size) / 2;
207#define ITER NS(SELF, iter)
223 size_t const total_size = front_size + back_size;
225 if (iter->pos < total_size) {
227 if (iter->pos < front_size) {
247 return (
ITER){.deque = self,
254#define ITER_CONST NS(SELF, iter_const)
270 size_t const total_size = front_size + back_size;
272 if (iter->pos < total_size) {
274 if (iter->pos < front_size) {
326#undef INVARIANT_CHECK
static void debug(SELF const *self, dc_debug_fmt fmt, FILE *stream)
static ITER_CONST get_iter_const(SELF const *self)
static bool empty(ITER const *iter)
static ITER get_iter(SELF *self)
static IV_PAIR next(ITER *iter)
static INDEX_TYPE size(SELF const *self)
#define INVARIANT_CHECK(self)
static bool empty_item(IV_PAIR const *item)
static VALUE const * read(SELF const *self, INDEX index)
static VALUE * write(SELF *self, INDEX index)
static SELF clone(SELF const *self)
static VALUE const * try_read(SELF const *self, INDEX index)
static ITEM pop_front(SELF *self)
static ITEM * try_write_from_back(SELF *self, size_t index)
static ITEM pop_back(SELF *self)
static ITEM * try_write_from_front(SELF *self, size_t index)
static void push_back(SELF *self, ITEM item)
static ITEM const * try_read_from_back(SELF const *self, size_t index)
static ITEM const * try_read_from_front(SELF const *self, size_t index)
static void push_front(SELF *self, ITEM item)
static SELF new_with_capacity(size_t front_and_back_capacity, ALLOC *alloc)
static void rebalance(SELF *self)
#define DC_TRAIT_QUEUE(SELF)
static ITEM * push(SELF *self, ITEM item)
static ITEM pop(SELF *self)
static void transfer_reverse(SELF *source, SELF *target, size_t to_move)
dc_debug_fmt dc_debug_fmt_scope_end(dc_debug_fmt fmt)
dc_debug_fmt dc_debug_fmt_scope_begin(dc_debug_fmt fmt)
static void dc_debug_fmt_print(dc_debug_fmt fmt, FILE *stream, const char *format,...)
static dc_gdb_marker dc_gdb_marker_new()
static mutation_tracker mutation_tracker_new()
static void mutation_version_check(mutation_version const *self)
static mutation_version mutation_tracker_get(mutation_tracker const *self)
static void mutation_tracker_mutate(mutation_tracker *self)
#define EXPAND_STRING(NAME)
#define DC_ASSUME(expr,...)
static bool dc_deque_rebalance_policy(size_t total_size, size_t front_size)
#define TEMPLATE_ERROR(...)
With the user provided name, even in nested templates.
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 FILE * stream(SELF *self)
Opens a file for.