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 = /*...*/;