|
Boost Users : |
Subject: Re: [Boost-users] [range] filtered dereferences underlying range elements twice
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-05-31 23:41:39
How does memoized work? Does it make a copy of the element?
Does it use dynamic allocation?
Thanks,
Nate.
----------------------------------------
> Date: Wed, 1 Jun 2011 12:39:51 +0900
> From: faithandbrave_at_[hidden]
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [range] filtered dereferences underlying range elements twice
>
> High cost sometime if filtered always store dereferenced-value.
> I think memoized adaptor was better to external store design. or add
> stored_filtered adaptor.
>
> 2011/6/1 Akira Takahashi :
> > Nate,
> > follow is filtered + transformed adaptor's internal behavior.
> >
> > [filtered]
> > increment iterator behavior:
> > while (!pred(*it)) ++it;
> >
> > dereference iterator behavior:
> > *it;
> >
> >
> > [transformed]
> > increment iterator behavior:
> > ++it;
> >
> > dereference iterator behavior:
> > f(*it);
> >
> >
> > [filtered | transformed]
> > increment iterator behavior:
> > while (!pred(*it)) ++it;
> >
> > dereference iterator behavior:
> > f(*it);
> >
> >
> > [transformed | filtered]
> > increment iterator behavior:
> > while (!pred(f(*it))) ++it;
> >
> > dereference iterator behavior:
> > f(*it);
> >
> > oven::memoized is call once function by stored calculation.
> >
> >
> > 2011/6/1 Nathan Ridge :
> >>
> >> Thanks Akira, it is good to know that there is a workaround.
> >>
> >> But I was wondering, is it necessary in the first place for filtered
> >> to dereference the underlying range elements twice?
> >>
> >> Thanks,
> >> Nate.
> >>
> >
>
>
> >>========================
> Akira Takahashi
> mailto:faithandbrave_at_[hidden]
> blog:http://d.hatena.ne.jp/faith_and_brave/
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net