33 if (destination != NULL)
48 size_t first_pass_size;
57 if (destination != NULL)
59 memcpy(destination, self->
front, first_pass_size);
60 destination += first_pass_size;
62 self->
front += first_pass_size;
63 self->
count -= first_pass;
67 if (first_pass < count)
81 if (destination != NULL)
bool deque_is_empty(const deque_t *self)
True if no elements are currently stored.
size_t deque_count(const deque_t *self)
The number of elements currently held in the queue.
bool deque_pop_back(deque_t *self, void *destination)
Pops the last element in the queue.
bool deque_pop_back_n(deque_t *self, void *destination, size_t count)
Pops the count last elements in the queue.
bool deque_pop_front(deque_t *self, void *destination)
Pops the front-most element of the queue, copying it to destination.
bool deque_pop_front_n(deque_t *self, void *destination, size_t count)
Pops the count first elements of the queue.
Realtime double-ended queues.
size_t deque_distance(const deque_t *self, const void *one, const void *two)
Number of elements in the range delimited by the two provided elements.
size_t deque_offset(const deque_t *self, size_t count)
The size in memory of count elements.
void * deque_pointer_before(const deque_t *self, void *pointer)
The previous slot.
void * deque_begin(const deque_t *self)
Pointer to the start of the underlying storage.
void * deque_end(const deque_t *self)
Pointer one-past-the-end of the underlying storage.
void * deque_pointer_after(const deque_t *self, void *pointer)
The next slot.
#define min(a, b)
Evaluates as the smallest of the two parameters.
Dynamic string implementation.
void * back
Pointer past-the-end of the queue.
void * front
Pointer to the front of the queue.
size_t count
Number of elements currently stored.