nnodes


Description:

public int nnodes ()

Gets the number of nodes in a Tree.

Example: Get the number of nodes:

public static int main (string[] args) {
Tree<string, string> tree = new Tree<string, string>.full ((a, b) => { return strcmp (a, b); }, free, free);
tree.insert ("key1", "val1");
tree.insert ("key2", "val2");
tree.insert ("key3", "val3");

// Output: ``nodes: 3``
int cnt = tree.nnodes ();
print ("nodes: %d\n", cnt);

return 0;
}

valac --pkg glib-2.0 GLib.Tree.nnodes.vala

Parameters:

this

a Tree

Returns:

the number of nodes in this

The node counter value type is really a uint, but it is returned as a int due to backward compatibility issues (can be cast back to uint to support its full range of values).