optimize mp_remove_if

compiler |      gcc-15       |     clang-20
before   | 0:00.21s - 67308K | 0:00.51s - 137744K
after    | 0:00.21s - 66956K | 0:00.49s - 138492K

```cpp
template<class> using pred = mp_true;
template<class I, class L = mp_iota<I>> using test
  = mp_remove_if<L, pred>;

using r1 = mp_transform<test, mp_iota_c<120>>;
```
This commit is contained in:
Jonathan Poelen
2025-11-09 02:07:47 +01:00
parent 72365c218e
commit 2cded73813
+1 -2
View File
@@ -32,8 +32,7 @@ template<template<class...> class L, class... T, template<class...> class P> str
template<class U> struct _f { using type = mp_if<P<U>, mp_list<>, mp_list<U>>; };
using type = mp_append<L<>, typename _f<T>::type...>;
#else
template<class U> using _f = mp_if<P<U>, mp_list<>, mp_list<U>>;
using type = mp_append<L<>, _f<T>...>;
using type = mp_append<L<>, mp_if<P<T>, mp_list<>, mp_list<T>>...>;
#endif
};