-void cxListDestroy(CxList *list) {
- switch (list->content_destructor_type) {
- case CX_DESTRUCTOR_SIMPLE: {
- CxIterator iter = cxListIterator(list);
- cx_foreach(void*, elem, iter) {
- // already correctly resolved pointer - immediately invoke dtor
- list->simple_destructor(elem);
- }
- break;
- }
- case CX_DESTRUCTOR_ADVANCED: {
- CxIterator iter = cxListIterator(list);
- cx_foreach(void*, elem, iter) {
- // already correctly resolved pointer - immediately invoke dtor
- list->advanced_destructor.func(list->advanced_destructor.data, elem);
- }
- break;
- }
- case CX_DESTRUCTOR_NONE:
- break; // nothing
- }
+static cx_list_class cx_empty_list_class = {
+ cx_emptyl_noop,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ cx_emptyl_noop,
+ NULL,
+ cx_emptyl_at,
+ cx_emptyl_find,
+ cx_emptyl_noop,
+ cx_emptyl_compare,
+ cx_emptyl_noop,
+ cx_emptyl_iterator,
+};
+
+CxList cx_empty_list = {
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ false,
+ &cx_empty_list_class,
+ NULL
+};
+
+CxList *const cxEmptyList = &cx_empty_list;