ListSG.append

Adds a new element on to the end of the list.

The return value is the new start of the list, which may have changed, so make sure you store the new value.

Note that g_slist_append() has to traverse the entire list to find the end, which is inefficient when adding multiple elements. A common idiom to avoid the inefficiency is to prepend the elements and reverse the list when all elements have been added.

|[<!-- language="C" --> // Notice that these are initialized to the empty list. GSList *list = NULL, *number_list = NULL;

// This is a list of strings. list = g_slist_append (list, "first"); list = g_slist_append (list, "second");

// This is a list of integers. number_list = g_slist_append (number_list, GINT_TO_POINTER (27)); number_list = g_slist_append (number_list, GINT_TO_POINTER (14)); ]|

class ListSG
append
(
void* data
)

Parameters

data void*

the data for the new element

Return: the new start of the #GSList

Meta