Provide a proper equivalent of mpl::eval_if
- Dominant language
- C++
- Stars
- 291
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
There are cases when I find `mpl::eval_if` much easier to use than `mp11::mp_eval_if`, `mp11::mp_if`, `mp11::mp_cond` and `mp11::mp_defer`. For example, converting something like [this](https://github.com/boostorg/iterator/blob/d6297a553be066043108f307b1d10c2e42fcacd6/include/boost/iterator/detail/facade_iterator_category.hpp#L79-L103) to Boost.MP11 is rather painful if one wants to preserve lazy evaluation of all `eval_if` branches in the tree. One particular pain point is that `mp_defer` does not compose with anything that takes template template parameters, including `mp_eval_if` and `mp_defer` itself.
It would be helpful if Boost.MP11 provided a direct equivalent of `mpl::eval_if`. Specifically, a metafunction that would lazily instantiate each of the branches depending on the condition, where the branches implement the `::type` protocol. In general, I think the library could use a better support for the `::type` protocol.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading include/boost/iterator/detail/facade_iterator_category.hpp, especially the referenced eval_if usage, then compare mp_eval_if, mp_if, mp_cond, and mp_defer in Boost.MP11. The desired result is a direct mpl::eval_if equivalent that lazily instantiates selected branches while using the ::type protocol; the issue does not name tests or implementation files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100