--- matrix_expression.hpp.orig 2008-05-07 14:30:32.000000000 +0100 +++ matrix_expression.hpp 2008-06-10 17:38:26.736266000 +0100 @@ -10,6 +10,9 @@ // GeNeSys mbH & Co. KG in producing this work. // +// Modified matrix_reference to construct reference from reference +// properly, by Kian Ming A. Chai (10 Jun 2008) + #ifndef _BOOST_UBLAS_MATRIX_EXPRESSION_ #define _BOOST_UBLAS_MATRIX_EXPRESSION_ @@ -49,6 +52,18 @@ namespace boost { namespace numeric { na explicit matrix_reference (referred_type &e): e_ (e) {} + // Construction from a reference to a non-const E + template + BOOST_UBLAS_INLINE + explicit matrix_reference (const matrix_reference &e, + typename boost::enable_if_c< + boost::is_const::value && + boost::is_same::type, + nonconstE>::value>::type* = 0): + e_(e.expression()) + {} + + // Accessors BOOST_UBLAS_INLINE size_type size1 () const {