Boost logo

Boost Users :

Subject: Re: [Boost-users] [range] filtered dereferences underlying range elements twice
From: Akira Takahashi (faithandbrave_at_[hidden])
Date: 2011-05-31 23:04:34


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 <zeratul976_at_[hidden]>:
>
> 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.
>


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