Doubly-linked list

Back to Data structures

A doubly-linked list is a data structure for storing and manipulating a sequence of elements.

Types

Generic data structure
List
Stable settings-aliases
List_Set

Properties

The doubly-linked list implementation in Pastel has the following properties:

Task / Property Complexity
Insert / remove an element, before a given element.
Move an element, before a given element in a given list.
Move all elements, from a list to another.
Move a range of elements, inside a list.
Move a range of elements, from a list to another.
Find out the number of elements in a list.
Find out whether an iterator is null / begin / end / normal.

Node data

Each node stores the list structure. Each normal node additionally stores a user-data. Each end-node additionally stores an end-data, and a user-data if the user so specifies. Both the user-data and the end-data can be specified as void, to avoid allocating memory for them.

Versus std::list

The list implementation in Pastel can be thought of an enhanced std::list:

Debugging

The doubly-linked list is subject to the iterator debugging problem, and so the user-data or the end-data cannot be inspected directly through the debugger.

Files

Doubly-linked list

List concepts

List invariants

List iterator

List module

List node

Merge an ordered list to another

Partition a list

Remove consecutive equivalent elements from a list

Remove indicated elements from a list

Reverse a list

Sort a list

Testing for List

Types for the list