Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56625 - branches/release/boost/numeric/ublas
From: guwi17_at_[hidden]
Date: 2009-10-06 19:31:22


Author: guwi17
Date: 2009-10-06 19:31:22 EDT (Tue, 06 Oct 2009)
New Revision: 56625
URL: http://svn.boost.org/trac/boost/changeset/56625

Log:
see #3397
 * merged [56045] into release
 * add enable_if to operator* for scalar*vector, vector*scalar, scalar*matrix, matrix*scalar in order to hinder unexpected instantiation.

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

Modified: branches/release/boost/numeric/ublas/matrix_expression.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/matrix_expression.hpp (original)
+++ branches/release/boost/numeric/ublas/matrix_expression.hpp 2009-10-06 19:31:22 EDT (Tue, 06 Oct 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: branches/release/boost/numeric/ublas/vector_expression.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/vector_expression.hpp (original)
+++ branches/release/boost/numeric/ublas/vector_expression.hpp 2009-10-06 19:31:22 EDT (Tue, 06 Oct 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