Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-04-28 05:53:26


On Mon, Apr 28, 2008 at 3:50 AM, David Abrahams
<dave_at_[hidden]> wrote:
>
> on Fri Mar 07 2008, Steven Watanabe <watanabesj-AT-gmail.com> wrote:
>
> > AMDG
> >
> > Giovanni Piero Deretta wrote:
> >> It seems a perfect application for fold:
> >>
> >> template<typename Seq>
> >> struct or_seq
> >> : mpl::apply<
> >> mpl::fold<mpl::_1, mpl::false_, mpl::quote2<mpl::or_> >
> >> , Seq
> >> > {};
> >>
> >> template<typename Seq>
> >> struct and_seq
> >> : mpl::apply<
> >> mpl::fold<mpl::_1, mpl::true_, mpl::quote2<mpl::and_> >
> >> , Seq
> >> > {};
> >>
> >
> > Not quite, because we want it to short circuit.
> > Not to mention that quote2 will not work on and_ and or_.
>
> Yeah, these should be rewritten in terms of mpl::find.
> Not sure why mpl::apply was used here either, though maybe I'm missign
> something.
>

There is, in fact, no need to use it here. I'm just so used to write
'apply' to prevent ugly "typename ... ::type" boilerplate that
instinctively stick it in mpl expressions even when they do not add
anything.

-- 
gpd

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