diff --git a/include/boost/numeric/ublas/matrix_expression.hpp b/include/boost/numeric/ublas/matrix_expression.hpp index 2f19c544..dfe6dc73 100644 --- a/include/boost/numeric/ublas/matrix_expression.hpp +++ b/include/boost/numeric/ublas/matrix_expression.hpp @@ -275,6 +275,11 @@ namespace boost { namespace numeric { namespace ublas { #endif // Assignment + BOOST_UBLAS_INLINE + matrix_reference &operator = (const matrix_reference &m) { + expression ().operator = (m); + return *this; + } template BOOST_UBLAS_INLINE matrix_reference &operator = (const matrix_expression &ae) { @@ -324,6 +329,20 @@ namespace boost { namespace numeric { namespace ublas { return *this; } + // Swapping + BOOST_UBLAS_INLINE + void swap (matrix_reference &v) { + if (this != &v) { + expression ().swap (v.expression ()); + } + } +#ifndef BOOST_UBLAS_NO_MEMBER_FRIENDS + BOOST_UBLAS_INLINE + friend void swap (matrix_reference &m1, matrix_reference &m2) { + m1.swap (m2); + } +#endif + // Closure comparison BOOST_UBLAS_INLINE bool same_closure (const matrix_reference &mr) const { diff --git a/include/boost/numeric/ublas/vector_expression.hpp b/include/boost/numeric/ublas/vector_expression.hpp index 4b455283..74928340 100644 --- a/include/boost/numeric/ublas/vector_expression.hpp +++ b/include/boost/numeric/ublas/vector_expression.hpp @@ -289,6 +289,11 @@ namespace boost { namespace numeric { namespace ublas { #endif // Assignment + BOOST_UBLAS_INLINE + vector_reference &operator = (const vector_reference &v) { + expression ().operator = (v); + return *this; + } template BOOST_UBLAS_INLINE vector_reference &operator = (const vector_expression &ae) { @@ -338,6 +343,20 @@ namespace boost { namespace numeric { namespace ublas { return *this; } + // Swapping + BOOST_UBLAS_INLINE + void swap (vector_reference &v) { + if (this != &v) { + expression ().swap (v.expression ()); + } + } +#ifndef BOOST_UBLAS_NO_MEMBER_FRIENDS + BOOST_UBLAS_INLINE + friend void swap (vector_reference &v1, vector_reference &v2) { + v1.swap (v2); + } +#endif + // Closure comparison BOOST_UBLAS_INLINE bool same_closure (const vector_reference &vr) const {