Boost logo

Boost :

From: Craig Hicks (hicks_at_[hidden])
Date: 2001-02-28 09:52:22


> Yep, I'm a big fan of lambda-type libraries as well, but in this case I'd
> rather do
>
> void apply_fn(CType & t)
> {
> std::for_each(t.begin(), t.end(), Fn);
> }
>
> std::for_each(c.begin(), c.end(), apply_fn);
>
> --
> Peter Dimov
> Multi Media Ltd.

Hi,

I think your solution is short, but apply_fn has to be written outside the
main procudure definition, so it will also be sparse. This is a basic
problem with STL I think. In the end there is a lot of scrolling to do.
I would rather write a double loop and have it all in one place.

Cheers,

Craig Hicks

----- Original Message -----
From: Peter Dimov <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, February 28, 2001 9:24 PM
Subject: Re: [boost] Re: does boost have iterators for nested std::list, or
si milar ?

> From: <yahoo_at_[hidden]>
>
>
> > --- In boost_at_y..., Gary Powell <Gary.Powell_at_s...> wrote:
> > > Well if your compiler has partial specialization, lambda does this
> > very
> > > nicely.
> > >
> > > std::for_each(c.begin(), c.end(),
> > ll::for_each(free1->(&CType::begin),
> > >
> > free1->(&CType::end),
> > > _Fn);
> > >
> > > Where _Fn can be another Lambda statement or a functor.
> > > -gary-
> >
> > As much as I enjoy LL (I demand LL support to even consider using a
> > compiler !), I think it's more a job for an iterator adaptor
> > based on a pair<OuterContainerIterator, InnerContainerIterator>
> > ( I've hastly crafted some ugly code to do that),
> > but maybe a deep_view would be even better :-)
>
> Yep, I'm a big fan of lambda-type libraries as well, but in this case I'd
> rather do
>
> void apply_fn(CType & t)
> {
> std::for_each(t.begin(), t.end(), Fn);
> }
>
> std::for_each(c.begin(), c.end(), apply_fn);
>
> --
> Peter Dimov
> Multi Media Ltd.
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>


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