Index

Deque

  • _new()
  • _new_custom()
  • _clear()
  • _free()
  • _customize()
  • _push_front()
  • _push_back()
  • _pop_front()
  • _front()
  • _back()
  • _contains()
  • _empty()
  • _full()
  • _count()
  • _capacity()
  • _flag()
  • _resize()
  • _copy_of()
  • _equals()
  • _to_string()
  • _print()

Deque Iterator

WIP.

_new()

Allocates on the heap and returns a new Deque with an internal capacity of the specified value. The Deque will be empty, using the default allocator cmc_alloc_node_default and no callbacks will be set, that is, callbacks will be set to NULL. Its flag will be initially cmc_flags.OK.

Declaration

struct SNAME *PFX##_new(size_t capacity, struct SNAME##_fval *f_val);

Parameters

ParameterRequiredDescription
size_t capacityYesThe initial Deque capacity
struct SNAME##_fval *f_valYesA Functions Table for V

Returns

ReturnsWhen
struct SNAME *If operation was successful
NULLIf allocation failed, if capacity is 0 or if f_val is NULL

_new_custom()

Like _new() but allows for custom allocation node and callbacks. The allocation node is optional. If present, the function will immediately use it to allocate the new Deque. If NULL, cmc_alloc_node_default will instead be used.

Declaration

struct SNAME *PFX##_new_custom(size_t capacity, struct SNAME##_fval *f_val, struct cmc_alloc_node *alloc, struct cmc_callbacks *callbacks);

Parameters

ParameterRequiredDescription
size_t capacityYesThe initial Deque capacity
struct SNAME##_fval *f_valYesA Functions Table for V
struct cmc_alloc_node *allocNoA custom allocation node
struct cmc_callbacks *callbacksNoA custom callbacks struct

Returns

ReturnsWhen
struct SNAME *If operation was successful
NULLIf allocation failed, if capacity is 0 or if f_val is NULL