Boost logo

Boost Users :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2020-03-04 20:41:15


On 3/4/20 1:13 PM, deb via Boost-users wrote:
> Hello,
> I am currently learning about mp11 from the docs . While mpl had an
> iterator functionality to get an alias over a type in mp_list it seemed
> mp11's mp_rest could be used for a similar task. So I coded up a simple
> example of recursing over a type list based on some type check , but am
> quite lost trying to make it work . So a possible pseudo code for the above
> might be
> template<typename list>
> struct recurse{
> using rest_of_list=mp_rest<list>;
> using type = typename std::conditional<
> mp_empty<rest_of_list>::value,
> base type here on empty list,
> typename std::conditional<
> some "loop" break condition,
> type on true condition,
> typename recurse<
> rest_of_list >::type
> >::type
>> ::type;
> }
> Is this even possible or there exists some other method to do the same in
> mp11.
> Thanks.
>
>
>
> --
> Sent from: http://boost.2283326.n4.nabble.com/Boost-Users-f2553780.html
>
**maybe** the following is close to what you want:

https://github.com/cppljevans/variadic_templates/blob/master/boost/mpl/if_recur.hpp

Honestly, I've not looked closely at your requirements, but your
description of the problem "sounds" close to what the if_recur
could solve.

I'd appreciate any feedback on whether this is any help ;)

-regards,
Larry


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net