cv cv__getitem2__(cv& m, slice r) { slice::range<cv::iterator> bounds; bounds = r.get_indicies<>(m.begin(), m.end()); long num = (bounds.stop-bounds.start+1); // round num up to the next multiple of bounds.step. if ((num%bounds.step) != 0) num += bounds.step - num%bounds.step; cv temp(num/bounds.step); if (temp.size() == 0) return temp; long ii = 0; while(bounds.start != bounds.stop) { temp(ii++) = *bounds.start; std::advance(bounds.start, bounds.step); } temp(ii) = *bounds.start; return temp; }