|
Boost Users : |
Subject: Re: [Boost-users] [range] filtered dereferences underlying range elements twice
From: Akira Takahashi (faithandbrave_at_[hidden])
Date: 2011-05-31 23:39:51
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 <faithandbrave_at_[hidden]>:
> 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.
>>
>
>>========================
Akira Takahashi
mailto:faithandbrave_at_[hidden]
blog:http://d.hatena.ne.jp/faith_and_brave/
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