I was trying to compose iter::product with iter::range so as to iterate over all the coordinate pairs of a matrix. Unfortunately, I can't manage to get it work with iter::range, wheres there's no problem with ranges generated with boost::irange. Here's a showcase example:
int main() {
// this work
for (auto&& ij: iter::product(boost::irange(0, 10), boost::irange(0, 5))) {
std::cout << std::get<0>(ij) << "," << std::get<1>(ij) << std::endl;
}
// this does not work
for (auto&& ij: iter::product(iter::range(10), iter::range(5))) {
std::cout << std::get<0>(ij) << "," << std::get<1>(ij) << std::endl;
}
}
clang reports:
note: copy assignment operator of 'Iterator' is implicitly deleted because field 'step' is of const-qualified type 'const int'
const T step;
Thanks and sorry for submitting two reports in a row!
test case added to testproduct.cpp. const qualifier removed from step. should work as intended now. no need for apologies, the reports are much appreciated.
Hi,
I was trying to compose
iter::product
withiter::range
so as to iterate over all the coordinate pairs of a matrix. Unfortunately, I can't manage to get it work withiter::range
, wheres there's no problem with ranges generated withboost::irange
. Here's a showcase example:clang reports:
Thanks and sorry for submitting two reports in a row!