...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
checks whether the data-type provided is an integer, castable float, string,
or wstring.
spreadsort
integer_sort
is used.
float_sort
is used.
string_sort
is used.
integer_sort
,
float_sort
and string_sort
directly, as spreadsort
won't accept types that don't have the appropriate type traits.
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.
function provides a wrapper that calls the fastest sorting algorithm available
for a data-type, enabling faster generic programming.
spreadsort
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 float
s,
vector<float> vec; vec.push_back(1.0); vec.push_back(2.3); vec.push_back(1.3); ... spreadsort(vec.begin(), vec.end()); //The sorted vector contains "1.0 1.3 2.3 ..."
See also floatsample.cpp which checks for abnormal values.