itertools::bubble_sort

#include <itertools.hpp>

Synopsis

  1. template<typename ForwardIt, typename Compare = std::less<>
    std::size_t bubble_sort (ForwardIt first, ForwardIt last, Compare comp = {})
  2. template<typename Range, typename Compare = std::less<>
    std::size_t bubble_sort (Range && rng, Compare comp = {})

Documentation

Template parameters

  • ForwardIt Forward iterator type.

  • Compare Comparison function type.

  • Range Forward range type.

Parameters

  • first Forward iterator to the first element of the range.

  • last Forward iterator to the element after the last of the range.

  • comp Comparison function callable with two dereferenced iterators.

  • rng A forward range to sort.

Returns

Number of swaps necessary to sort the range.