From cd2c492be70be875f4e97cb12a8e70d6890e69a2 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 8 Dec 2019 03:20:59 +0200 Subject: [PATCH] Document mp_flatten --- doc/mp11/algorithm.adoc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/mp11/algorithm.adoc b/doc/mp11/algorithm.adoc index 70477b5..3af8a99 100644 --- a/doc/mp11/algorithm.adoc +++ b/doc/mp11/algorithm.adoc @@ -502,6 +502,26 @@ Removes all elements `T` of `L` for which `mp_to_bool>` is `mp_true` and re As `mp_remove_if`, but takes a quoted metafunction. +## mp_flatten + + template> using mp_flatten = /*...*/; + +Replaces all elements `T` of `L` that are lists of the same form as `L2` (that is, those for which +`mp_similar` is `mp_true`) with their elements and returns the result. + +.Using mp_flatten +``` +using L1 = tuple, void, tuple>; +using R1 = mp_flatten; // tuple + +using L2 = mp_list, tuple>; +using R2a = mp_flatten; // mp_list> +using R2b = mp_flatten>; // mp_list, void> + +using L3 = mp_list, mp_list>>; +using R3 = mp_flatten; // mp_list> +``` + ## mp_partition template class P> using mp_partition = /*...*/;