Commit Graph

356 Commits

Author SHA1 Message Date
Jonathan Poelen 2c96255255 fix mp_replace_at with msvc-12 2025-11-09 20:33:36 +01:00
Jonathan Poelen 49747e7e48 fix mp_map_update with msvc-12 2025-11-09 20:33:36 +01:00
Jonathan Poelen e8e97059ec optimize mp_map_replace
compiler |       gcc-12       |      clang-15
before   | 0:00.46s - 187160K | 0:00.38s - 129104K
after    | 0:00.21s - 80236K  | 0:00.33s - 123644K

```cpp
using namespace boost::mp11;

template<class L, class M = mp_transform<mp_list, L>>
struct f { template<class I> using g = mp_map_replace<M, mp_list<I, I>>; };

template<class I, class L = mp_iota<I>> using test
  = mp_transform<f<L>::template g, L>;

using r1 = mp_transform<test, mp_iota_c<30>>;
```
2025-11-09 20:33:36 +01:00
Jonathan Poelen a1ba7c2b6b optimize mp_map_erase (extract f from the struct to benefit from memoization)
compiler |       gcc-12       |      clang-15
before   | 0:00.52s - 197128K | 0:00.44s - 140780K
after    | 0:00.47s - 183968K | 0:00.43s - 139336K

```cpp
using namespace boost::mp11;

template<class L, class M = mp_transform<mp_list, L>>
struct f { template<class I> using g = mp_map_erase<M, I>; };

template<class I, class L = mp_iota<I>> using test
  = mp_transform<f<L>::template g, L>;

using r1 = mp_transform<test, mp_iota_c<30>>;
```
2025-11-09 20:33:36 +01:00
Jonathan Poelen de54a2b597 optimize mp_map_update (extract f from the struct to benefit from memoization)
compiler |       gcc-12       |      clang-15
before   | 0:00.73s - 270224K | 0:00.54s - 156112K
after    | 0:00.19s - 85004K  | 0:00.29s - 119232K

```cpp
using namespace boost::mp11;

template<class L, class M = mp_transform<mp_list, L>>
struct f { template<class I> using g = mp_map_update<M, mp_list<I>, mp_list>; };

template<class I, class L = mp_iota<I>> using test
  = mp_transform<f<L>::template g, L>;

using r1 = mp_transform<test, mp_iota_c<20>>;
```
2025-11-09 20:33:36 +01:00
Jonathan Poelen 7fe439513e optimize mp_map_find (extract f from the struct to benefit from memoization)
compiler |       gcc-12       |      clang-15
before   | 0:00.29s - 128600K | 0:00.25s - 120604K
after    | 0:00.22s - 99908K  | 0:00.23s - 116084K

```cpp
using namespace boost::mp11;

template<class L, class M = mp_transform<mp_list, L>>
struct f { template<class I> using g = mp_map_find<M, I>; };

template<class I, class L = mp_iota<I>> using test
  = mp_transform<f<L>::template g, L>;

using r1 = mp_transform<test, mp_iota_c<50>>;
```
2025-11-09 20:33:36 +01:00
Jonathan Poelen f6768fef35 optimize mp_power_set (extract f from the struct to benefit from memoization)
compiler |       gcc-12       |      clang-15
before   | 0:01.35s - 538732K | 0:00.65s - 203924K
after    | 0:01.02s - 396032K | 0:00.65s - 203080K

```cpp
using namespace boost::mp11;

template<class I> using test = mp_power_set<mp_iota<I>>;

using r1 = mp_transform<test, mp_iota_c<15>>;
```
2025-11-09 20:33:36 +01:00
Jonathan Poelen a76ce80d1a optimize mp_replace_at (extract f from the struct to benefit from memoization)
compiler |       gcc-12       |      clang-15
before   | 0:00.34s - 134428K | 0:00.33s - 124720K
after    | 0:00.29s - 116920K | 0:00.32s - 122568K

```cpp
using namespace boost::mp11;

template<class I> using f = mp_replace_at<mp_iota<I>, I, void>;
template<class I> using test = mp_transform<f, mp_iota<I>>;

using r1 = mp_transform<test, mp_iota_c<50>>;
```
2025-11-09 20:33:36 +01:00
Jonathan Poelen 88314f6877 optimize mp_sort (extract f from the struct to benefit from memoization)
compiler |       gcc-12       |      clang-15
before   | 0:00.46s - 198848K | 0:00.49s - 132632K
after    | 0:00.42s - 183384K | 0:00.48s - 131748K

```cpp
using namespace boost::mp11;

template<class I> using test = mp_sort<mp_iota<I>, mp_less>;

using r1 = mp_transform<test, mp_iota_c<25>>;
```
2025-11-09 20:33:36 +01:00
Jonathan Poelen 225f67982c optimize mp_drop (extract f from the struct to benefit from memoization)
compiler |       gcc-12       |      clang-15
before   | 0:00.48s - 192464K | 0:00.48s - 154480K
after    | 0:00.43s - 172472K | 0:00.46s - 150404K

```cpp
template<class L> struct f { template<class I> using g = mp_drop<L, I>; };
template<class I, class L = mp_iota<I>> using test = mp_transform<f<L>::template g, L>;

using r1 = mp_transform<test, mp_iota_c<50>>;
```
2025-11-09 20:33:36 +01:00
Jonathan Poelen 94162fb325 optimize mp_filter (extract f from the struct to benefit from memoization)
compiler |       gcc-12      |      clang-15
before   | 0:00.16s - 72460K | 0:00.16s - 102068K
after    | 0:00.14s - 61884K | 0:00.16s - 101828K

```cpp
using namespace boost::mp11;

template<class T> using p = mp_bool<T::value & 1>;
template<class I> using test = mp_filter<p, mp_iota<I>>;

using r1 = mp_transform<test, mp_iota_c<50>>;
```
2025-11-09 20:33:36 +01:00
Jonathan Poelen b21ff00f9b optimize mp_transform_if (extract f from the struct to benefit from memoization)
compiler |       gcc-12      |      clang-15
before   | 0:00.13s - 60432K | 0:00.16s - 100956K
after    | 0:00.11s - 47300K | 0:00.16s - 100484K

```cpp
using namespace boost::mp11;

template<class T> using p = mp_bool<T::value & 1>;
template<class T> using f = mp_size_t<T::value + 1>;
template<class I> using test = mp_transform_if<p, f, mp_iota<I>>;

using r1 = mp_transform<test, mp_iota_c<50>>;
```
2025-11-09 20:33:36 +01:00
Peter Dimov 811aa7a0f1 Update mp_reverse_fold to work on fixed size lists. Fixes #108. 2025-10-21 18:51:31 +03:00
Peter Dimov 50e2a0a1b8 Update version 2025-10-09 18:32:10 +03:00
Peter Dimov 2fb81c2453 Update version 2025-06-28 08:20:51 +03:00
Peter Dimov 1a99027e8c Add an alternative implementation of mp_map_find for GCC 14+. Fixes #106. 2025-05-08 15:50:59 +03:00
Peter Dimov 9910ada772 Clang considers the specialization ambiguous in C++17 and above, rewrite. Fixes #103. 2025-01-07 22:52:07 +02:00
Peter Dimov 7ca1e0a92b Add a specialization of mp_from_sequence_impl to handle the defaulted offset case. Fixes #103. 2025-01-07 21:10:14 +02:00
Peter Dimov 82533c431e Do not use fold expressions for mp_find and mp_find_if 2024-12-21 21:48:37 +02:00
Peter Dimov b108e01927 Update version 2024-12-13 22:43:40 +02:00
joaquintides 28929d9794 kept old impl for msvc 12.0 2024-11-08 22:07:10 +01:00
joaquintides c2bc9788ca made mp_is_set<S> robust when S is not a list 2024-11-08 19:50:48 +01:00
joaquintides 13a81c86ee added missing #include 2024-11-08 19:21:27 +01:00
joaquintides fb79d23aac improved performance of mp_is_set 2024-11-08 19:08:50 +01:00
Peter Dimov 1caff7ffa9 Change second occurrence of the same code in mp_count.hpp to match 2024-10-22 19:50:32 +03:00
Chris Ward 44a731d868 Candidate fix
code without "if constexpr"
2024-10-22 08:59:32 +01:00
Peter Dimov 8ceb48b4c9 Stylistic changes to mp_lambda 2024-10-14 19:37:36 +03:00
joaquintides ead27ca191 Feature/lambda (#96)
* added mp_lambda

* launched GHA

* skipped ICE-generating test in GCC < 4.9

* fixed GCC detection in workaround

* test-skipped and documented GCC 4.8 bug

* added missing s/const/CONST

* tempirarily expanded macro to isolate problem with VS2017

* tried workaround for C3546

* tried another workaround

* wrapped workaround up

* dropped unnecessary devoiding in variadic (member) functions

* temporary code to check VS compliance wrt function qualifiers

* removed version printer

* checked compliance with qualified (member) function partial specialization

* checked each partial specialization individually

* wrapped up VS2013 investigation

* left variadics out of VS2013

* skipped noexcept-involving tests for VS2013 (keyword not supported)

* given up on VS2013 support for mp_lambda

* dropped lambda_devoid_args
2024-10-14 18:15:14 +03:00
Peter Dimov a064da5757 Update version 2024-08-17 04:25:45 +03:00
Peter Dimov 859a30e46f Update version 2024-04-18 12:06:16 +03:00
Peter Dimov 20fff14a90 Use push_macro/pop_macro to guard against the macro I from <complex.h>. Fixes #88. 2023-12-21 21:55:24 +02:00
Peter Dimov 679834bfdc Update version 2023-12-19 13:20:05 +02:00
Peter Dimov 4db3374eed Add value list support to mp_transform (for up to three lists). Closes #86. 2023-12-18 05:53:20 +02:00
Peter Dimov ee5f1d620f Add value list support to mp_min_element, mp_max_element. Fixes #87. 2023-12-17 20:37:56 +02:00
Braden Ganetsky 0c491bcd77 Move mp_slice_c and mp_slice into the public API 2023-11-27 19:07:38 -06:00
Peter Dimov 0715df5ca8 Reformulate mp_sliding_fold to pass msvc-14.0 2023-11-27 01:46:58 +02:00
Peter Dimov 629cebd5f8 Merge branch 'develop' of https://github.com/k3DW/mp11 into feature/pr-84 2023-11-26 19:47:53 +02:00
Peter Dimov e1c4b281ec Update version 2023-08-12 23:44:06 +03:00
Braden Ganetsky 247ffe8afe Add mp_sliding_fold 2023-07-30 22:54:14 -05:00
Ilya Popov 46c4e8a517 Remove usages of old style cast, use static_cast instead
This silences compiler warnings generated by GCC
2023-06-23 16:58:51 +02:00
Peter Dimov 1a8fa7064c Add value list support to mp_drop. Refs #53. 2023-05-16 20:24:06 +03:00
Peter Dimov c1a012ad45 Add value list support to mp_take. Refs #53. 2023-05-16 19:46:38 +03:00
Peter Dimov 73626ba3bc Add value list support to mp_at. Refs #53. 2023-05-16 19:13:56 +03:00
Peter Dimov 799c2e6079 Add value list support to mp_fill. Refs #53. 2023-05-16 18:34:16 +03:00
Peter Dimov e93cf70178 Make mp_is_value_list public. Refs #53. 2023-05-16 17:19:23 +03:00
Peter Dimov efbaa77749 Add test/mp_repeat_3.cpp 2023-05-16 17:02:38 +03:00
Peter Dimov f19d2d9bd4 Apply the mp_append optimization to the value list case as well 2023-05-16 03:41:49 +03:00
Peter Dimov 64ed9449cb Refactor mp_append slightly 2023-05-16 03:19:32 +03:00
Peter Dimov 64532c4792 Add support for (homogeneous) value lists to mp_append. Refs #53. 2023-05-16 02:37:59 +03:00
Peter Dimov 0113ee9246 Add support for value lists to mp_transform_first, mp_transform_second, mp_transform_third. Refs #53. 2023-05-15 20:11:34 +03:00