Subject: Re: [boost] [GIL] kth_channel_view
Date: 2010-08-05 11:02:31
Yes, it works fine without const.
I used const automatically because I don't write in my image but I don't think it changes something.
So without seems to be better because it's not the correct way to deal with const inside gil.
I don't know how we can declare a parameter to be a const view...
For example a simple function that takes an image v and returns if it contains a pixel p:
bool f( const MyGilConstView& v, const MyGilConstView::value_type& p );
This function can't garantee that it doesn't modify the image v and the pixel p.
I can create a const view at the begining of the function, to get this garantee, like this:
typedef MyGilConstView::const_t MyGilReallyConstView;
typedef MyGilReallyConstView::value_type MyGilReallyConstPixel; // as there is no const_t typedef in pixel type...
MyGilReallyConstView cv = v;
MyGilReallyConstPixel cp = p;
Is it correct ?
Is there a better way to do it ?
PS: maybe a "typedef value_type pixel_t" inside the view class can be a good thing for readability ?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk