Boost logo

Boost :

Subject: Re: [boost] Is there any interest in a library for actor programming? [preliminary submission]
From: Dominik Charousset (dominik.charousset_at_[hidden])
Date: 2014-05-14 01:53:01


> On 11 May 2014, at 09:36 pm, Larry Evans wrote
>
> Hi Dominik,
>
> On 05/08/14 12:30, Dominik Charousset wrote post
> http://article.gmane.org/gmane.comp.lib.boost.devel/250747
> including:
> [snip]
>>
>> [3] https://github.com/Neverlord/boost.actor/blob/a0cab41e2946df7d751c59dfead0c2122da0fb77/boost/actor/detail/int_list.hpp
>
> However, I have a question about the implementation.
>
> https://github.com/Neverlord/boost.actor/blob/a0cab41e2946df7d751c59dfead0c2122da0fb77/boost/actor/detail/int_list.hpp#L83
>
> uses a recursive call using a List<typename ...Ts> which is 1 shorter
> than the argument list, List<T0, Ts...>.
> Why not just pass sizeof...(T0, Ts...):
>
> http://en.cppreference.com/w/cpp/language/sizeof...
>
> and keep adding indices while decreasing this sizeof value,
> as done here:
>
> http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/mpl/package_range_c.hpp
>
> in the package_range_c template class where:
>
> Start value would be 0
> and Finish value would be sizeof...(T0, Ts...)
>
> It achieves the same result, but without producing unneeded
> instantiations. For example:
>
> package_range_c<std::size_t,0,sizeof...(mpl::vector<T0,T2,T3>>::type
> package_range_c<std::size_t,0,sizeof...(mpl::vector<S0,S2,S3>>::type
>
> would produce 1 instantiation of:
>
> package_range_c<std::size_t,0,3>
>
> whereas the int_list.hpp code would, IIUC, produce the same
> number of instantiations for the T's and S's.
>
> Wouldn't using the sizeof... method be easier to understand
> as well as produce few instantions?

Reviewing the code again, I think there's really no good reason to recurse over Ts. Doing the unrolling in il_indices recursively with only two specializations is a simple design, but the instantiations of type_list are indeed unnecessary. Also, the dependency to type_list could be dropped when unrolling based on sizeof....

> -regards,
> Larry
>
> NOTE: I tried to post to the newsgroup; however, apparently my
> post got lost :(

Let's hope the list is working again...


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk