ListMergeSort Class Template Reference
[Embedded Linked List Package]

Merge-sort functor for ListItem lists. More...

#include <list.h>

List of all members.

Static Public Member Functions

static void Sort (ListItem &list, int itemcount, param_t parameter)
 Invokes the MergeSort algorithm.
static void Sort (ListItem &list, param_t parameter)
 Alternative overload of Sort() which determines length.


Detailed Description

template<typename CompFunc>
class libhfp::ListMergeSort< CompFunc >

Merge-sort functor for ListItem lists.

Templated class with a single static function Sort(), used for sorting lists of any type of object, using the MergeSort algorithm. This is useful for sorting objects for which direct comparison is possible but no numeric value can easily be associated with each. Note the restrictions below. This well-known algorithm exhibits O(N * log2(N)) performance for sorting a list of N objects, guaranteed in all cases.

Parameters:
CompFunc Comparison function container-class.
The CompFunc container-class must contain the following members:


Member Function Documentation

static void Sort ( ListItem list,
int  itemcount,
param_t  parameter 
) [inline, static]

Invokes the MergeSort algorithm.

Sorts a list of ListItems. Operates recursively and can create a large call stack for long lists of objects to be sorted.

MergeSort must divide the list of items into two, so the length of the list must be known.

Parameters:
list List of items.
itemcount Number of items in list.
parameter Argument to the comparison function.

static void Sort ( ListItem list,
param_t  parameter 
) [inline, static]

Alternative overload of Sort() which determines length.

Version of Sort() that requires no length parameter.

Parameters:
list List of items.
parameter Argument to the comparison function.


The documentation for this class was generated from the following file:
Generated on Fri Jan 9 05:58:41 2009 for libhfp by  doxygen 1.5.4