diff --git a/doc/mp11/algorithm.adoc b/doc/mp11/algorithm.adoc index 1326fc3..9edba6f 100644 --- a/doc/mp11/algorithm.adoc +++ b/doc/mp11/algorithm.adoc @@ -740,6 +740,37 @@ using R1 = mp_partial_sum, mp_plus>; // mp_list_c + + template class F> using mp_pairwise_fold = /*...*/; + +`mp_pairwise_fold` returns a list of the same form as `L` whose elements are +the result of the application of the binary metafunction `F` to each pair of adjacent +elements of `L`. That is, `mp_pairwise_fold, F>` is +`L, F>`. + +The result has one fewer element than the original. If `L` has only one element, the +result is an empty list. If `L` is an empty list, the result is also an empty list. + +.Using mp_pairwise_fold +---- +template using is_increasing = mp_all_of< + mp_pairwise_fold, mp_to_bool>; +---- + +## mp_pairwise_fold_q + + template using mp_pairwise_fold_q = + mp_pairwise_fold; + +As `mp_pairwise_fold`, but takes a quoted metafunction. + +.Using mp_pairwise_fold_q +---- +template using is_nondecreasing = mp_none_of< + mp_pairwise_fold_q>, mp_to_bool>; +---- + ## mp_iterate template class F, template class R>