Boost logo

Boost :

Subject: Re: [boost] [review][mp11] Reminder of ongoing formal review
From: Peter Dimov (lists_at_[hidden])
Date: 2017-07-23 12:42:18

> Roberto Hinz wrote:
> > Hi,
> >
> > not a review yet.
> > I´m just wondering: would the implementation below perfom better than
> > the recursive version of mp_find_impl ?
> > I think it should perform better when one uses mp_find several times in
> > the same list.
> > It also compiles in vs2013.
> It performs better across the board (for repeated finds).

Upon further experimentation, while it does perform very well for repeated
finds such as those done by this test case:

    using L1 = mp_iota_c<300>;
    template<class T> using F = mp_find<L1, T>;
    using L2 = mp_transform<F, L1>;
    static_assert( std::is_same<L1, L2>::value, "L1 != L2" );

it has a large one-time cost in both time and heap space, making it
unsuitable for N in the thousands.

Still a significant improvement over the recursive version, but on balance,
not over the constexpr-based one.

Very nice work nevertheless.

Boost list run by bdawes at, gregod at, cpdaniel at, john at