|
Boost : |
Subject: Re: [boost] [GIL] locator and cached_location_t
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-12-14 11:54:26
Hi Fabien, I have never used or even heard of cached_location. So, I
don't feel comfortable to answer design decisions.
Sorry,
Christian
On Sun, Dec 12, 2010 at 2:37 PM, fabien <fabien.castan_at_[hidden]> wrote:
> Hi,
> I like the idea of cached_location, but I have some questions about it.
>
> //// a simple usage example:
> // get a temporary locator from the view
> const SLocator loc_ref = srcView.xy_at(0,0);
> // from this locator we can extract a cached_location
> typename SLocator::cached_location_t LT( loc_ref.cache_location(-1,-1) );
>
> DPixel func( const SLocator& src )
> {
> // now instead of doing this:
> return src(-1, -1);
>
> // we can directly retrieve the pixel
> // from the locator using this cached location
> return src[LT];
> }
>
> I have 2 questions:
> 1) Why can't we directly get a cached_location from a view (without using a
> locator) ? We have all informations in the view to build it, isn't it ?
> typename SLocator::cached_location_t LT( srcView.cache_location(-1,-1) );
>
> 2) Is there a good reason to not allows to get a locator from another
> locator using cached_location ?
>
> DLocator func( const SLocator& src )
> {
> // we can do this
> return src.xy_at(-1, -1); // return a new locator
>
> // we can't do the same thing with cached_location
> return src.xy_at(LT); //< it can be interesting to do this !
> }
>
> Same remark to get an x_iterator from a locator:
> src.x_at(-1, -1); //< we can do this
> src.x_at(LT); //< we can't do this
>
> Best regards,
> Fabien Castan
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk