|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +nav-class: dark |
| 4 | +categories: joaquin |
| 5 | +title: Joaquín's Q4 2024 Update |
| 6 | +author-id: joaquin |
| 7 | +author-name: Joaquín M López Muñoz |
| 8 | +--- |
| 9 | + |
| 10 | +During Q4 2024, I've been working in the following areas: |
| 11 | + |
| 12 | +### Boost.Mp11 |
| 13 | + |
| 14 | +* Implemented [`mp_lambda`](https://www.boost.org/libs/mp11/doc/html/mp11.html#lambda) |
| 15 | +(released in Boost 1.87.0), a metaprogramming utility inspired by the venerable |
| 16 | +[_placeholder expressions_ from Boost.MPL](https://live.boost.org/libs/mpl/doc/refmanual/placeholder-expression.html). |
| 17 | +`mp_lambda` allows us to generate complex types specified with a rather natural syntax |
| 18 | +in terms of elementary input types indicated by |
| 19 | +[Boost.Mp11 _placeholder types_](https://www.boost.org/libs/mp11/doc/html/mp11.html#1_9). |
| 20 | +For instance, `std::pair<_1*, _2*>` can be regarded as a type template with |
| 21 | +two placeholder positions, and `mp_lambda<std::pair<_1*, _2*>>::fn<int, char>` is, |
| 22 | +unsurprisingly enough, the type `std::pair<int*, char*>`. My original motivation |
| 23 | +for writing this utility is to provide a Boost.Mp11 equivalent to Boost.MPL lambda |
| 24 | +expressions that can pave the way for an eventual modernization of |
| 25 | +Boost.Flyweight, which [relies heavily](https://www.boost.org/libs/flyweight/doc/tutorial/configuration.html#factory_types) |
| 26 | +on this functionality from Boost.MPL. |
| 27 | +* Rewritten the implementation of `mp_is_set` |
| 28 | +([PR#100](https://github.com/boostorg/mp11/pull/100), released in Boost 1.87.0) to |
| 29 | +achieve some rather noticeable compile-time improvements. |
| 30 | + |
| 31 | +### Boost.PolyCollection |
| 32 | + |
| 33 | +* Added the new [`boost::variant_collection`](https://www.boost.org/doc/libs/develop/doc/html/poly_collection/reference.html#poly_collection.reference.header_boost_poly_collection_va0) |
| 34 | +container (to be released in Boost 1.88.0). |
| 35 | +`boost::variant_collection_of<Ts...>` is similar to |
| 36 | +`std::vector<std::variant<Ts...>>`, with the crucial difference that elements |
| 37 | +storing the same alternative type are grouped together. For instance, the following: |
| 38 | +```cpp |
| 39 | +boost::variant_collection_of<int, double, std::string> c; |
| 40 | +// ... |
| 41 | +for(const auto& x:c) { |
| 42 | + visit( |
| 43 | + [](const auto& x) { std::cout << x << "\n"; }, |
| 44 | + x); |
| 45 | +} |
| 46 | +``` |
| 47 | +will print first the `int`s in the collection, then the `double`s, and finally |
| 48 | +the `std::string`s. In exchange for this restriction, important |
| 49 | +[processing speedups](https://www.boost.org/doc/libs/develop/doc/html/poly_collection/performance.html#poly_collection.performance.processing_tests.results_for_boost_variant_collec) |
| 50 | +can be obtained. |
0 commit comments