I've wrote a class inherit from boost matrix, however, I can't figure out how to access the random access operator "()" inside the class.
For instance, I can use "()" outside the class by m.(x, y) = some_value, however, inside the class I can't just using (x, y) = some_value, although my compiler didn't complain this way, some_value will not be assigned successfully.
Neither this(x, y), *this(x, y), this->(x, y) will pass the compiler. (I have to confess that I'm not familiar with the usage of "this"...)
Besides, I can't examine the value of x_location and y_location inside the following for-loop, is it a bug of gdb?
Here is my code, any idea?
using namespace std ;
using namespace boost::numeric ;
class Target_Region: public ublas::matrix<bool>
Target_Region( const int width, const int height, const vector<int> to_be_inpaint_vec_x, const vector<int> to_be_inpaint_vec_y )
assert( to_be_inpaint_vec_x.size() == to_be_inpaint_vec_y.size() ) ;
bool preserve_previous_value = false ;
resize( width, height, preserve_previous_value ) ;
// for each pixel location in to_be_inpaint_vec, markup to true in the target region
vector<int>::const_iterator x_location_iter = to_be_inpaint_vec_x.begin() ;
vector<int>::const_iterator y_location_iter = to_be_inpaint_vec_y.begin() ;
int x_location = 0 ;
int y_location = 0 ;
for( ; x_location_iter != to_be_inpaint_vec_x.end() ; ++x_location_iter, ++y_location_iter )
x_location = *x_location_iter ;
y_location = *y_location_iter ;
( x_location, y_location ) = true ;