I copy your code into my vc2003. But there is no error. Maybe there is set wrong with your IDE.


Wenming Yu


发件人: ublas-bounces@lists.boost.org [mailto:ublas-bounces@lists.boost.org] 代表 Francisco J. González
发送时间: 2006年1月13 1:42
收件人: ublas@lists.boost.org
主题: [ublas] Coordinate matrix compile error




I'm using Boost beta 1.33.1 with Microsoft Visual C++ 2003. I'm having problems with the coordinate_matrix: the following code


#include <boost/numeric/ublas/matrix_sparse.hpp>
int main () {
    boost::numeric::ublas::coordinate_matrix<double> m (3, 3, 3*3);
 m(0,0) = 1.0;


generates an error in line #3 (see the attached file with the complete build log):


c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Vc7\include\algorithm(368) :
error C2664:
'void std::swap<boost::numeric::ublas::indexed_iterator<C,IC>::reference>(_Ty &,_Ty &)' :
cannot convert parameter 1
from 'boost::numeric::ublas::indexed_iterator<C,IC>::reference'
  to 'boost::numeric::ublas::indexed_iterator<C,IC>::reference &'
A reference that is not to 'const' cannot be bound to a non-lvalue


Do anybody knows the cause/workarround?


Fran J. González