Boost logo

Boost :

Subject: Re: [boost] [GSoC] [Boost.Hana] Formal review request
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2014-07-30 19:50:35


Louis Dionne <ldionne.2 <at> gmail.com> writes:

>
> pfultz2 <pfultz2 <at> yahoo.com> writes:
>
> [...]
>
> > > There are two things here. First, the decision not to split the library
> > > into
> > > a thousand headers was considered a feature, because it meant that you did
> > > not need to include countless headers to get some functionality. Since the
> > > library is very lightweight, it does not cause a compile-time performance
> > > problem to include the whole list.hpp header.
> >
> > Even so, in your implementation of list.hpp, it may not be performance hit
> > to include it together, but perhaps as a user, I could be adapting a type
> > where each of those methods are heavyweight, so I would want to seperate
> > them out into seperate headers.
>
> Ahhh, now I understand what you mean. I think that's possible and I'll
> reply when I'm fixed. Basically, I'll try to split the adaptor for Fusion
> into separate header and see if it works.

Ok, I tried it in a sandbox and here's what you could do:
    
    // In some forward declaration header.
    template <>
    struct Foldable::instance<YourDatatype> : Foldable::mcd {
        template <typename F, typename State, typename Xs>
        static constexpr auto foldl_impl(F f, State s, Xs xs);

        // other forward declarations ...
    };

    // In some header holding the actual implementation of foldl.
    template <typename F, typename State, typename Xs>
    constexpr auto Foldable::instance<YourDatatype>::
                   foldl_impl(F f, State s, Xs xs)
    {
        // ...
    }

Regards,
Louis


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