Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 0f79ae966a.


spreadsort checks whether the data-type provided is an integer, castable float, string, or wstring.

Overloading variants are provided that permit use of user-defined right-shift functors and comparison functors.

Each function is optimized for its set of arguments; default functors are not provided to avoid the risk of any reduction of performance.

See overloading section.


spreadsort function provides a wrapper that calls the fastest sorting algorithm available for a data-type, enabling faster generic programming.

See example folder for all examples.

See sample.cpp for a simple working example.

For an example of 64-bit integer sorting, see int64.cpp.

This example sets the element type of a vector to 64-bit integer

#define DATA_TYPE boost::int64_t

and calls the sort

boost::sort::spreadsort::spreadsort(array.begin(), array.end());

For a simple example sorting floats,

vector<float> vec;
spreadsort(vec.begin(), vec.end());
//The sorted vector contains "1.0 1.3 2.3 ..."

See also floatsample.cpp which checks for abnormal values.