optimize mp_map_replace

compiler |      gcc-15        |     clang-20
before   | 0:00.39s - 114524K | 0:00.66s - 155888K
after    | 0:00.38s - 114140K | 0:00.64s - 155184K

```cpp
template<class I, class L = mp_transform<mp_list, mp_iota<I>>> using test
  = mp_map_replace<L, mp_list<I,I>>;

using r1 = mp_transform<test, mp_iota_c<120>>;
```
This commit is contained in:
Jonathan Poelen
2025-11-09 02:16:04 +01:00
parent 2cded73813
commit d70897fee4
+1 -3
View File
@@ -46,9 +46,7 @@ template<template<class...> class M, class... U, class T> struct mp_map_replace_
#else
template<class V> using _f = mp_if< std::is_same<mp_first<V>, K>, T, V >;
using type = mp_if< mp_map_contains<M<U...>, K>, M<_f<U>...>, M<U..., T> >;
using type = mp_if< mp_map_contains<M<U...>, K>, M<mp_if< std::is_same<mp_first<U>, K>, T, U >...>, M<U..., T> >;
#endif
};