|
Boost : |
Subject: [boost] [GIL] locator and cached_location_t
From: fabien (fabien.castan_at_[hidden])
Date: 2010-12-12 14:37:52
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk