1
0
forked from boostorg/mp11

Document mp_filter

This commit is contained in:
Peter Dimov
2019-02-05 18:33:27 +02:00
parent 07892c8d73
commit 2d0567d984
2 changed files with 24 additions and 0 deletions

View File

@@ -149,6 +149,29 @@ using R1 = mp_transform_if_q<mp_bind<std::is_same, _1, void>, _2, L1, L2>;
|*mp_transform_if_q<Qp, _2, L1, L2>*|A~1~|B~2~|...|A~n~
|===
## mp_filter<P, L...>
template<template<class...> class P, class... L> using mp_filter = /*...*/;
`mp_filter<P, L1, L2, ..., Ln>` removes the elements of the list `L1` for which `mp_to_bool<P<T1, T2, ..., Tn>>`
is `mp_false` and returns the result, where `Ti` are the corresponding elements of `Li`.
See also `mp_copy_if` and `mp_remove_if`, less general variants of `mp_filter` that only take a single list.
## mp_filter_q<Qp, L...>
template<class Qp, class... L> using mp_filter_q =
mp_filter<Qp::template fn, L...>;
As `mp_filter`, but takes quoted metafunctions.
.Using mp_filter_q to pick elements of a list based on a mask in another list
```
using L1 = std::tuple<void, int, float>;
using L2 = mp_list<mp_true, mp_false, mp_true>;
using R1 = mp_filter_q<_2, L1, L2>; // std::tuple<void, float>
```
## mp_fill<L, V>
template<class L, class V> using mp_fill = /*...*/;

View File

@@ -17,6 +17,7 @@ http://www.boost.org/LICENSE_1_0.txt
* Add `mp_set_union`, `mp_set_intersection`, `mp_set_difference`
* Add `mp_not_fn`
* Add `mp_transform_first`, `mp_transform_second`, `mp_transform_third`
* Add `mp_filter`
## Changes in 1.69.0