The recommended way to sort large data set (which will typically be stored in a tpie::file_stream in TPIE) is to use one of the tpie::sort functions defined in sort.h.
When you have a tpie::file_stream over some type T
(opened for reading and writing), you can order the elements of this stream according to the order defined by the <
operator (i.e. using T::operator<
or operator<(T,T)
) simply invoke tpie::sort (mystream, mystream). When the input and output stream is the same, the temporary space usage of tpie::sort is the same as the space used by the input stream.
If you wish to store the result in a stream different from the input stream, supply this stream as the second argument to tpie::sort, this requires extra space equivalent to twice the space used by the input stream.
The current interface is defined in the tpie
namespace, but legacy definitions exist in the tpie::ami
namespace.