insert_before


Description:

[ Version ( since = "2.4" ) ]
public void insert_before (List<G> sibling, owned G data)

Inserts data into this before sibling.

sibling must be part of this. Since GLib 2.44 a null sibling pushes the data at the tail of the queue.

Example: Insert before:

public static int main (string[] args) {
Queue<int> queue = new Queue<int> ();
queue.push_tail (1);
queue.push_tail (3);

unowned List<int> pos = queue.find (3);
queue.insert_before (pos, 2);

// Output: ``1 2 3 ``
int item = 0;
while ((item = queue.pop_head ()) != 0) {
print ("%d ", item);
}
print ("\n");

return 0;
}

valac --pkg glib-2.0 GLib.Queue.insert_before.vala

Parameters:

this

a Queue

sibling

a List link that must be part of this, or null to push at the tail of the queue.

data

the data to insert