Re: [Boost-bugs] [Boost C++ Libraries] #10127: coordinate_matrix sort() fails on to std::swap

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10127: coordinate_matrix sort() fails on to std::swap
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-06-16 15:01:26


#10127: coordinate_matrix sort() fails on to std::swap
-------------------------------+---------------------
  Reporter: anonymous | Owner:
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: None
   Version: Boost 1.54.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+---------------------

Comment (by Casey Carter <Casey@…>):

 Test case can be minimized to:
 {{{
 #include <boost/numeric/ublas/matrix_sparse.hpp>

 int main() {
   boost::numeric::ublas::coordinate_matrix<int> m1(1, 1, 1);
   m1.insert_element(0, 0, 0);
 }
 }}}

 The problem seems to be that when BOOST_UBLAS_STRICT_MATRIX_SPARSE is
 defined, coordinate_matrix and its iterator types use a proxy class as
 their reference type:

 {{{
 #ifndef BOOST_UBLAS_STRICT_MATRIX_SPARSE
         typedef T &reference;
 #else
         typedef sparse_matrix_element<self_type> reference;
 #endif
 }}}

 which violates the C++ standard's requirement that the reference type for
 forward iterators is a true reference. C++11 [forward.iterators]/1 states:
 "A class or pointer type X satisfies the requirements of a forward
 iterator if ... '''if X is a mutable iterator, reference is a reference
 to T; if X is a const iterator, reference is a reference to const T,'''
 ...".

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10127#comment:1>
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:50:16 UTC