...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::sort::spreadsort::float_sort — float_sort
with casting to the appropriate size.
// In header: <boost/sort/spreadsort/float_sort.hpp> template<typename RandomAccessIter> void float_sort(RandomAccessIter first, RandomAccessIter last);
Some performance plots of runtime vs. n and log(range) are provided:
windows_float_sort
osx_float_sort
A simple example of sorting some floating-point is:
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 ascending values "1.0 1.3 2.3".
Parameters: |
|