5.10. sorting_utils.hpp¶
Full path: graph_canon/sorting_utils.hpp
-
template<typename
Iter
, typenamePred
, typenameSwap
>
Iterpartition_range
(Iter first, Iter last, Pred pred, Swap swapper)¶ A function template equivalent to
std::partition
, except that element swapping is delegated to the givenswapper
.Requires (in addition to the requirements by
std::partition
), that for two dereferenceable iteratorsa
andb
in the given range, the expressionswapper(a, b)
swaps the values represented by the iterators. For example,Swap
may be a predicate simply callingstd::iter_swap
.
-
template<typename
SizeType
, SizeTypeMax
>
classcounting_sorter
¶ An object for performing counting sort of values in the range 0 to
Max
. RequiresMax >= 2
.-
template<typename
Iterator
, typenameToValue
, typenameCallback
, typenamePutValue
>
voidoperator()
(const Iterator first, const Iterator last, ToValue toValue, Callback callback, PutValue putter)¶ -
Requires:
Iterator
must model aRandomAccessIterator
.ToValue
: for a dereferenceable iteratoriter
, the expressiontoValue(*iter)
must return an integer in the range 0 toMax
.Callback
: for a range of integersends
representing the end of each bucket, as offsets fromfirst
, the expressioncallback(ends)
must be valid.PutValue
: for a dereferenceable iteratoriter
and an elementelem
, the expressionputter(iter, elem)
must be valid, and ensure that*iter == elem
becomes true.
-
template<typename