17 #ifndef BOOST_FLOAT_SORT_HPP
18 #define BOOST_FLOAT_SORT_HPP
23 #include <boost/static_assert.hpp>
24 #include <boost/sort/spreadsort/detail/constants.hpp>
25 #include <boost/sort/spreadsort/detail/float_sort.hpp>
46 template<
class Data_type,
class Cast_type>
51 BOOST_STATIC_ASSERT(
sizeof(Cast_type) ==
sizeof(Data_type));
52 BOOST_STATIC_ASSERT(std::numeric_limits<Data_type>::is_iec559);
53 BOOST_STATIC_ASSERT(std::numeric_limits<Cast_type>::is_integer);
55 std::memcpy(&result, &data,
sizeof(Cast_type));
85 template <
class RandomAccessIter>
86 inline void float_sort(RandomAccessIter first, RandomAccessIter last)
88 if (last - first < detail::min_sort_size)
89 std::sort(first, last);
104 template <
class RandomAccessIter,
class Right_shift>
105 inline void float_sort(RandomAccessIter first, RandomAccessIter last,
108 if (last - first < detail::min_sort_size)
109 std::sort(first, last);
128 template <
class RandomAccessIter,
class Right_shift,
class Compare>
129 inline void float_sort(RandomAccessIter first, RandomAccessIter last,
130 Right_shift rshift, Compare comp)
132 if (last - first < detail::min_sort_size)
133 std::sort(first, last, comp);
Definition: float_sort.hpp:27
void float_sort(RandomAccessIter first, RandomAccessIter last, Right_shift rshift, Compare comp)
Float sort algorithm using random access iterators with both right-shift and user-defined comparison ...
Definition: float_sort.hpp:129
Cast_type float_mem_cast(const Data_type &data)
Casts a float to the specified integer type.
Definition: float_sort.hpp:48
void float_sort(RandomAccessIter first, RandomAccessIter last)
float_sort with casting to the appropriate size.
Definition: float_sort.hpp:86