Boost C++ Libraries

...one 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 an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Function template float_sort

boost::sort::spreadsort::float_sort

Synopsis

// In header: <boost/sort/spreadsort/float_sort.hpp>


template<typename RandomAccessIter> 
  void float_sort(RandomAccessIter first, RandomAccessIter last);

Description

\brief @c float_sort with casting to the appropriate size. \param[in] first Iterator pointer to first element. \param[in] last Iterator pointing to one beyond the end of data.

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". 


PrevUpHomeNext