Template Function sequant::sort_via_ordinals

Function Documentation

template<OrderType OT, typename Sequence, typename LessThan>
container::svector<std::size_t> sequant::sort_via_ordinals(Sequence &seq, const LessThan &less_than)

sorts a directly-addressable sequence via ordinals

less-than relationship for elements i and i+1 is given by less_than(i,i+1)

Template Parameters:

OT – the type of order provided by LessThen

Parameters:
  • seq[inout] on input: a directly-addressable sequence; on output: the sorted sequence

  • less_than[in] less-than comparison of two ordinals defines the weak order between the corresponding elements; does not have to be strict (i.e. does not have to meet the standard Compare concept used by standard algorithms)

Returns:

ordinals of sorted elements in the input sequence