Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56045 - trunk/boost/numeric/ublas
From: guwi17_at_[hidden]
Date: 2009-09-05 08:51:11


Author: guwi17
Date: 2009-09-05 08:51:10 EDT (Sat, 05 Sep 2009)
New Revision: 56045
URL: http://svn.boost.org/trac/boost/changeset/56045

Log:
see #3397

vector_expression.hpp: added enable_if to expression scalar * vector and vector * scalar

matrix_expression.hpp: added enable_if to expression scalar * matrix and matrix * scalar

Text files modified:
   trunk/boost/numeric/ublas/matrix_expression.hpp | 4 ++++
   trunk/boost/numeric/ublas/vector_expression.hpp | 4 ++++
   2 files changed, 8 insertions(+), 0 deletions(-)

Modified: trunk/boost/numeric/ublas/matrix_expression.hpp
==============================================================================
--- trunk/boost/numeric/ublas/matrix_expression.hpp (original)
+++ trunk/boost/numeric/ublas/matrix_expression.hpp 2009-09-05 08:51:10 EDT (Sat, 05 Sep 2009)
@@ -2940,7 +2940,9 @@
     // (t * m) [i] [j] = t * m [i] [j]
     template<class T1, class E2>
     BOOST_UBLAS_INLINE
+ typename enable_if< is_convertible<T1, typename E2::value_type >,
     typename matrix_binary_scalar1_traits<const T1, E2, scalar_multiplies<T1, typename E2::value_type> >::result_type
+ >::type
     operator * (const T1 &e1,
                 const matrix_expression<E2> &e2) {
         typedef typename matrix_binary_scalar1_traits<const T1, E2, scalar_multiplies<T1, typename E2::value_type> >::expression_type expression_type;
@@ -3373,7 +3375,9 @@
     // (m * t) [i] [j] = m [i] [j] * t
     template<class E1, class T2>
     BOOST_UBLAS_INLINE
+ typename enable_if< is_convertible<T2, typename E1::value_type>,
     typename matrix_binary_scalar2_traits<E1, const T2, scalar_multiplies<typename E1::value_type, T2> >::result_type
+ >::type
     operator * (const matrix_expression<E1> &e1,
                 const T2 &e2) {
         typedef typename matrix_binary_scalar2_traits<E1, const T2, scalar_multiplies<typename E1::value_type, T2> >::expression_type expression_type;

Modified: trunk/boost/numeric/ublas/vector_expression.hpp
==============================================================================
--- trunk/boost/numeric/ublas/vector_expression.hpp (original)
+++ trunk/boost/numeric/ublas/vector_expression.hpp 2009-09-05 08:51:10 EDT (Sat, 05 Sep 2009)
@@ -1170,7 +1170,9 @@
     // (t * v) [i] = t * v [i]
     template<class T1, class E2>
     BOOST_UBLAS_INLINE
+ typename enable_if< is_convertible<T1, typename E2::value_type >,
     typename vector_binary_scalar1_traits<const T1, E2, scalar_multiplies<T1, typename E2::value_type> >::result_type
+ >::type
     operator * (const T1 &e1,
                 const vector_expression<E2> &e2) {
         typedef typename vector_binary_scalar1_traits<const T1, E2, scalar_multiplies<T1, typename E2::value_type> >::expression_type expression_type;
@@ -1395,7 +1397,9 @@
     // (v * t) [i] = v [i] * t
     template<class E1, class T2>
     BOOST_UBLAS_INLINE
+ typename enable_if< is_convertible<T2, typename E1::value_type >,
     typename vector_binary_scalar2_traits<E1, const T2, scalar_multiplies<typename E1::value_type, T2> >::result_type
+ >::type
     operator * (const vector_expression<E1> &e1,
                 const T2 &e2) {
         typedef typename vector_binary_scalar2_traits<E1, const T2, scalar_multiplies<typename E1::value_type, T2> >::expression_type expression_type;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk