summaryrefslogtreecommitdiff
path: root/lib/gl_list.hh
Commit message (Collapse)AuthorAgeFilesLines
* list: Add operations first_node, last_node.Bruno Haible2021-04-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Marc Nieper-Wißkirchen in <https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00005.html>. * lib/gl_list.h (gl_list_first_node, gl_list_last_node): New functions. (struct gl_list_implementation): Add members first_node, last_node. * lib/gl_array_list.c (gl_array_first_node, gl_array_last_node): New functions. (gl_array_list_implementation): Add the new operations. * lib/gl_carray_list.c (gl_carray_first_node, gl_carray_last_node): New functions. (gl_carray_list_implementation): Add the new operations. * lib/gl_anylinked_list2.h (gl_linked_first_node, gl_linked_last_node): New functions. * lib/gl_linked_list.c (gl_linked_list_implementation): Add the new operations. * lib/gl_linkedhash_list.c (gl_linkedhash_list_implementation): Likewise. * lib/gl_anytree_list2.h (gl_tree_first_node, gl_tree_last_node): New functions. * lib/gl_avltree_list.c (gl_avltree_list_implementation): Add the new operations. * lib/gl_avltreehash_list.c (gl_avltreehash_list_implementation): Likewise. * lib/gl_rbtree_list.c (gl_rbtree_list_implementation): Likewise. * lib/gl_rbtreehash_list.c (gl_rbtreehash_list_implementation): Likewise. * lib/gl_sublist.c (gl_sublist_first_node, gl_sublist_last_node): New functions. (gl_sublist_list_implementation): Add the new operations. * lib/gl_list.hh (class gl_List): Add member functions first_node, last_node. * doc/containers.texi: Update table.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* list-c++, [o]map-c++, [o]set-c++: Fix conflict with 'free-posix' module.Bruno Haible2020-12-301-0/+2
| | | | | | | | * lib/gl_list.hh: Include <stdlib.h>. * lib/gl_map.hh: Likewise. * lib/gl_omap.hh: Likewise. * lib/gl_set.hh: Likewise. * lib/gl_oset.hh: Likewise.
* list-c++, set-c++, oset-c++, map-c++, omap-c++: Don't fool the compiler.Bruno Haible2020-05-311-2/+14
| | | | | | | | | | | Reported by Akim Demaille in <https://lists.gnu.org/archive/html/bug-bison/2020-05/msg00102.html>. * lib/gl_list.hh (gl_List::iterator::next): Avoid a reinterpret_cast. * lib/gl_set.hh (gl_Set::iterator::next): Likewise. * lib/gl_oset.hh (gl_OSet::iterator::next): Likewise. * lib/gl_map.hh (gl_Map::iterator::next): Likewise. * lib/gl_omap.hh (gl_OMap::iterator::next): Likewise.
* list-c++: Add get_first, get_last, set_first, set_last operations.Bruno Haible2020-05-031-0/+22
| | | | | | * lib/gl_list.hh (class gl_List): Add methods get_first, get_last, set_first, set_last. * lib/gl_list.h: Tweak comments.
* list: Add remove_first and remove_last operations.Bruno Haible2020-05-021-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suggested by Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-04/msg00092.html>. * lib/gl_list.h (struct gl_list_implementation): Add fields remove_first, remove_last. (gl_list_remove_first, gl_list_remove_last): New functions. * lib/gl_array_list.c (gl_array_remove_first, gl_array_remove_last): New functions, based on gl_array_remove_at. (gl_array_list_implementation): Implement the new operations. * lib/gl_carray_list.c (gl_carray_remove_first, gl_carray_remove_last): New functions, based on gl_carray_remove_at. (gl_carray_list_implementation): Implement the new operations. * lib/gl_anylinked_list2.h (gl_linked_remove_first, gl_linked_remove_last): New functions, based on gl_linked_remove_at. * lib/gl_linked_list.c (gl_linked_list_implementation): Implement the new operations. * lib/gl_linkedhash_list.c (gl_linkedhash_list_implementation): Likewise. * lib/gl_anytree_list2.h (gl_tree_remove_first, gl_tree_remove_last): New functions, based on gl_tree_remove_at. * lib/gl_avltree_list.c (gl_avltree_list_implementation): Implement the new operations. * lib/gl_avltreehash_list.c (gl_avltreehash_list_implementation): Likewise. * lib/gl_rbtree_list.c (gl_rbtree_list_implementation): Likewise. * lib/gl_rbtreehash_list.c (gl_rbtreehash_list_implementation): Likewise. * lib/gl_sublist.c (gl_sublist_remove_first, gl_sublist_remove_last): New functions, based on gl_sublist_remove_at. (gl_sublist_list_implementation): Implement the new operations. * lib/gl_list.hh (class gl_List): Add methods remove_first, remove_last. * tests/test-array_list.c (main): Test also gl_list_remove_first and gl_list_remove_last. * tests/test-avltree_list.c (main): Likewise. * tests/test-avltreehash_list.c (main): Likewise. * tests/test-carray_list.c (main): Likewise. * tests/test-linked_list.c (main): Likewise. * tests/test-linkedhash_list.c (main): Likewise. * tests/test-rbtree_list.c (main): Likewise. * tests/test-rbtreehash_list.c (main): Likewise.
* list-c++: New module.Bruno Haible2020-02-021-0/+365
* lib/gl_list.hh: New file, based on lib/gl_list.h. * modules/list-c++: New file.