[Rcpp-commits] r2440 - pkg/Rcpp/inst/include/Rcpp/vector

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 17 13:43:33 CET 2010


Author: romain
Date: 2010-11-17 13:43:33 +0100 (Wed, 17 Nov 2010)
New Revision: 2440

Modified:
   pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h
Log:
SubMatrix keeps the underlying matrix as non const

Modified: pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h	2010-11-17 12:34:57 UTC (rev 2439)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h	2010-11-17 12:43:33 UTC (rev 2440)
@@ -152,7 +152,7 @@
 	}
 	
 	inline SubMatrix<RTYPE> operator()( const Range& row_range, const Range& col_range){
-	    return SubMatrix<RTYPE>( *this, row_range, col_range ) ;
+	    return SubMatrix<RTYPE>( const_cast<Matrix&>(*this), row_range, col_range ) ;
 	}
 	
 	
@@ -223,7 +223,7 @@
     typedef Matrix<RTYPE> MATRIX ;
     typedef typename MATRIX::Proxy Proxy ;
     
-    SubMatrix( const MATRIX& m_, const Range& row_range_, const Range& col_range_ ) :
+    SubMatrix( MATRIX& m_, const Range& row_range_, const Range& col_range_ ) :
         m(m_), row_range(row_range_), col_range(col_range_) {}
     
     
@@ -236,7 +236,7 @@
     }
     
 private:
-    const MATRIX& m ;
+    MATRIX& m ;
     const Range& row_range ;
     const Range& col_range ;
 } ;



More information about the Rcpp-commits mailing list