id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 6072,Bad iterator difference for m.begin1() - m.end1() in ublas,Robin Palotai ,Gunter,"In functional.hpp at a couple of places, for example: static BOOST_UBLAS_INLINE difference_type distance_i (difference_type k, size_type /* size_i */, size_type size_j) { return size_j != 0 ? k / size_j : 0; } k [ / | % ] size_[ i | j ] is used, where k is difference_type (signed), size_i|j is size_type (unsigned). This results in promoting k to unsigned, and can yield very strange results when k is negative. For example, m being a size 2x2 ublas::matrix, m.begin1() - m.end1() yields 2147483646 instead of -2. Putting a static_cast(size_i|j) in functional.hpp seems to solve the problem.",Bugs,new,To Be Determined,uBLAS,Boost 1.47.0,Problem,,"iterator, distance",