Subject: [Boost-bugs] [Boost C++ Libraries] #2129: iterator problem in ublas::basic_range (boost/numeric/ublas/storage.hpp)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-07-19 19:26:43
#2129: iterator problem in ublas::basic_range (boost/numeric/ublas/storage.hpp)
-----------------------------------+----------------------------------------
Reporter: brian.tyler_at_[hidden] | Owner: guwi17
Type: Bugs | Status: new
Milestone: Boost 1.36.0 | Component: uBLAS
Version: Boost 1.35.0 | Severity: Problem
Keywords: |
-----------------------------------+----------------------------------------
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.
lines 937 - 941 of boost/numeric/ublas/storage.hpp read
{{{
const_iterator &operator -- () {
BOOST_UBLAS_CHECK (it_ > 0, bad_index ());
-- it_;
return *this;
}
}}}
Removing "BOOST_UBLAS_CHECK (it_ > 0, bad_index ());" solves the problem.
Similarly for the += and -= operators.
The documentation makes no mention of the range needing to consist only of
positive values and this seems a rather arbitrary restriction.
-- Ticket URL: <http://svn.boost.org/trac/boost/ticket/2129> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:58 UTC