Report a bugIf you spot a problem with this page, click here to create a Bugzilla issue.
Improve this pageQuickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinga local clone.
dmd.backend.dlist
Interface to the C linked list type.
List is a complete package of functions to deal with singly linked lists of pointers or integers.
Features
- Uses mem package.
- Has loop-back tests.
- Each item in the list can have multiple predecessors, enabling different lists to 'share' a common tail.
nothrow @nogc @safe list_t
list_next
(list_t
list
);
Returns:pointer to next entry in list.
nothrow @nogc @trusted inout(void)*
list_ptr
(inout list_t
list
);
Returns:ptr from list entry.
nothrow @nogc @safe int
list_data
(list_t
list
);
Returns:integer item from list entry.
nothrow @nogc @safe void
list_prependdata
(list_t*
plist
, int
d
);
Prepend integer item to list.
nothrow @nogc @trusted void
list_free
(list_t*
plist
, list_free_fp
freeptr
);
Free list.
Parameters:list_t*plist | Pointer to list to free |
list_free_fpfreeptr | Pointer to freeing function for the data pointer (use FPNULL if none) |
nothrow @nogc @trusted void*
list_subtract
(list_t*
plist
, void*
ptr
);
Remove ptr from the list pointed to by *plist.
Output*plist is updated to be the start of the new list
Returns:null if *plist is null otherwise ptr
nothrow @nogc @safe void*
list_pop
(list_t*
plist
);
Remove first element in list pointed to by *plist.
Returns:First element, null if *plist is null
nothrow @nogc @trusted list_t
list_append
(list_t*
plist
, void*
ptr
);
Append ptr to *plist.
Returns:pointer to list item created. null if out of memory
nothrow @nogc @trusted list_t
list_prepend
(list_t*
plist
, void*
ptr
);
Prepend ptr to *plist.
Returns:pointer to list item created (which is also the start of the list). null if out of memory
nothrow @nogc @safe int
list_nitems
(list_t
list
);
Count up and return number of items in list.
Returns:of entries in list
nothrow @nogc @safe list_t
list_nth
(list_t
list
, int
n
);
Returns:nth list entry in list.
nothrow @nogc @safe int
list_equal
(list_t
list1
, list_t
list2
);
Compare two lists.
Returns:If they have the same ptrs, return 1 else 0.
nothrow @nogc @trusted list_t
list_inlist
(list_t
list
, void*
ptr
);
Search for ptr in list.
Returns:If found, return list entry that it is, else null.
nothrow @nogc @trusted void
list_apply
(list_t*
plist
, void function(void*) nothrow @nogc
fp
);
Apply a function fp to each member of a list.
nothrow @nogc @safe list_t
list_reverse
(list_t
l
);
Reverse a list in place.
Range for Lists.