--- vector_expression.hpp.orig 2008-05-13 14:16:29.000000000 +0100 +++ vector_expression.hpp 2008-06-10 17:38:44.748916000 +0100 @@ -10,6 +10,10 @@ // GeNeSys mbH & Co. KG in producing this work. // +// Modified vector_reference to construct reference from reference +// properly, by Kian Ming A. Chai (10 Jun 2008) + + #ifndef _BOOST_UBLAS_VECTOR_EXPRESSION_ #define _BOOST_UBLAS_VECTOR_EXPRESSION_ @@ -49,12 +53,29 @@ namespace boost { namespace numeric { na explicit vector_reference (referred_type &e): e_ (e) {} + + // Construction from a reference to a non-const E + template + BOOST_UBLAS_INLINE + explicit vector_reference (const vector_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 size () const { return expression ().size (); }