Boost C++ Libraries: Ticket #2129: iterator problem in ublas::basic_range (boost/numeric/ublas/storage.hpp) https://svn.boost.org/trac10/ticket/2129 <p> Decrementing (--) a forward iterator through a basic_range containing negative values throws an error (bad_index). This seems inconsistent because it is possible to increment (++) through such a range without throwing error. </p> <p> lines 937 - 941 of boost/numeric/ublas/storage.hpp read </p> <pre class="wiki">const_iterator &amp;operator -- () { BOOST_UBLAS_CHECK (it_ &gt; 0, bad_index ()); -- it_; return *this; } </pre><p> Removing "BOOST_UBLAS_CHECK (it_ &gt; 0, bad_index ());" solves the problem. Similarly for the += and -= operators. </p> <p> The documentation makes no mention of the range needing to consist only of positive values and this seems a rather arbitrary restriction. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2129 Trac 1.4.3 Gunter Tue, 29 Jul 2008 20:06:07 GMT type, severity, milestone changed https://svn.boost.org/trac10/ticket/2129#comment:1 https://svn.boost.org/trac10/ticket/2129#comment:1 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Feature Requests</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Optimization</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.36.0</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> <p> The type of indices is by default "unsigned long". Thus we have to assure that we do not decrement a 0. Support of signed types for indices requires some work - I'll change this task to a feature request. </p> <p> Additionally, we should add checks to the increment functions. </p> Ticket