22 #if !defined PLACEHOLDERS
23 #error "The contained type must be defined for a deque template"
32 #define ITEM_DELETE item_delete
34 #define ITEM_CLONE item_clone
37#if !defined ITEM_DELETE
38 #define ITEM_DELETE(value)
41#if !defined ITEM_CLONE
42 #define ITEM_CLONE(value) (*(value))
48#define ITEM_VECTORS NS(NAME, item_vectors)
50#pragma push_macro("ALLOC")
51#pragma push_macro("ITEM")
52#pragma push_macro("ITEM_CLONE")
53#pragma push_macro("ITEM_DELETE")
56#define INTERNAL_NAME ITEM_VECTORS
59#pragma pop_macro("ALLOC")
60#pragma pop_macro("ITEM")
61#pragma pop_macro("ITEM_CLONE")
62#pragma pop_macro("ITEM_DELETE")
72#define INVARIANT_CHECK(self) \
74 ASSUME((self)->alloc);
101 .alloc = other->alloc,
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;
130 ASSUME(back_size > front_size + 1);
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;
145 if (front_size > 0) {
156 if (front_size > 0) {
237#define ITER NS(SELF, iter)
253 size_t const total_size = front_size + back_size;
255 if (iter->pos < total_size) {
257 if (iter->pos < front_size) {
268static bool NS(ITER,
empty)(ITER
const* iter) {
277 return (ITER){.deque = self,
284#define ITER_CONST NS(SELF, iter_const)
300 size_t const total_size = front_size + back_size;
302 if (iter->pos < total_size) {
304 if (iter->pos < front_size) {
315static bool NS(ITER_CONST,
empty)(ITER_CONST
const* iter) {
339#undef INVARIANT_CHECK
static bool empty_item(IV_PAIR const *const *item)
static ITER_CONST get_iter_const(SELF const *self)
static bool empty(ITER const *iter)
static ITER get_iter(SELF *self)
static INDEX_TYPE size(SELF const *self)
static IV_PAIR const * next(ITER *iter)
#define INVARIANT_CHECK(self)
static VALUE * try_write(SELF *self, INDEX index)
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 pop_back(SELF *self)
static void push_back(SELF *self, ITEM item)
static void item_delete(item_t *self)
static item_t item_clone(item_t const *self)
static void push_front(SELF *self, ITEM item)
static ITEM const * peek_front_read(SELF const *self)
static SELF new_with_capacity(size_t front_and_back_capacity, ALLOC *alloc)
static ITEM * peek_front_write(SELF *self)
static ITEM * peek_back_write(SELF *self)
static void rebalance(SELF *self)
static ITEM const * peek_back_read(SELF const *self)
#define 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)
static gdb_marker 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)
static bool deque_rebalance_policy(size_t total_size, size_t front_size)
mutation_tracker iterator_invalidation_tracker
gdb_marker derive_c_deque
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...