Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58290 - in sandbox/odeint/branches/karsten/boost/numeric/odeint: . detail
From: mario.mulansky_at_[hidden]
Date: 2009-12-11 09:19:58


Author: mariomulansky
Date: 2009-12-11 09:19:57 EST (Fri, 11 Dec 2009)
New Revision: 58290
URL: http://svn.boost.org/trac/boost/changeset/58290

Log:
static casts in container traits
Text files modified:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/container_traits_mtl4_dense2d.hpp | 4
   sandbox/odeint/branches/karsten/boost/numeric/odeint/detail/iterator_algebra.hpp | 126 ++++++++++++++++++---------------------
   2 files changed, 59 insertions(+), 71 deletions(-)

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/container_traits_mtl4_dense2d.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/container_traits_mtl4_dense2d.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/container_traits_mtl4_dense2d.hpp 2009-12-11 09:19:57 EST (Fri, 11 Dec 2009)
@@ -113,7 +113,7 @@
 
     operator ValueType() const
     {
- return map(*cursor);
+ return static_cast<ValueType>(map(*cursor));
     }
 
     self& operator=(ValueType const& value)
@@ -124,7 +124,7 @@
 
     self& operator+=(ValueType const& value)
     {
- map( *cursor, value + map(*cursor) );
+ map( *cursor, value + static_cast<ValueType>map(*cursor)) );
         return *this;
     }
 

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/detail/iterator_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/detail/iterator_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/detail/iterator_algebra.hpp 2009-12-11 09:19:57 EST (Fri, 11 Dec 2009)
@@ -36,9 +36,8 @@
                    T alpha
                    )
     {
- typedef typename std::iterator_traits<InputIterator>::value_type value_type;
         while( first1 != last1 )
- (*first1++) += alpha * static_cast<value_type>(*first2++);
+ (*first1++) += alpha * (*first2++);
     }
 
     // computes y = x1 - x2
@@ -72,9 +71,8 @@
                     InputIterator2 first3 ,
                     T alpha )
     {
- typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
         while( first1 != last1 )
- (*first1++) = (*first2++) + alpha * static_cast<value_type>(*first3++);
+ (*first1++) = (*first2++) + alpha * (*first3++);
     }
 
 
@@ -97,10 +95,9 @@
                            T alpha2
                            )
     {
- typedef typename std::iterator_traits<InputIterator3>::value_type value_type;
         while( first1 != last1 )
             (*first1++) += alpha1 *
- ( (*first2++) + (*first3++) + alpha2 * static_cast<value_type>(*first4++) );
+ ( (*first2++) + (*first3++) + alpha2 * (*first4++) );
     }
 
 
@@ -120,11 +117,10 @@
                            T alpha2 ,
                            InputIterator2 x2_begin )
     {
- typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
         while( y_begin != y_end )
             (*y_begin++) =
- alpha1 * static_cast<value_type>(*x1_begin++) +
- alpha2 * static_cast<value_type>(*x2_begin++);
+ alpha1 * (*x1_begin++) +
+ alpha2 * (*x2_begin++);
     }
 
 
@@ -145,12 +141,11 @@
                            T alpha3 ,
                            InputIterator3 x3_begin )
     {
- typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
         while( y_begin != y_end )
             (*y_begin++) =
- alpha1 * static_cast<value_type>(*x1_begin++) +
- alpha2 * static_cast<value_type>(*x2_begin++) +
- alpha3 * static_cast<value_type>(*x3_begin++);
+ alpha1 * (*x1_begin++) +
+ alpha2 * (*x2_begin++) +
+ alpha3 * (*x3_begin++);
     }
 
     // computes y = x1 + alpha2*x2 + alpha3*x3 + alpha4*x4
@@ -173,13 +168,12 @@
                            T alpha4 ,
                            InputIterator4 x4_begin )
     {
- typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
         while( y_begin != y_end )
             (*y_begin++) =
- alpha1 * static_cast<value_type>(*x1_begin++) +
- alpha2 * static_cast<value_type>(*x2_begin++) +
- alpha3 * static_cast<value_type>(*x3_begin++) +
- alpha4 * static_cast<value_type>(*x4_begin++);
+ alpha1 * (*x1_begin++) +
+ alpha2 * (*x2_begin++) +
+ alpha3 * (*x3_begin++) +
+ alpha4 * (*x4_begin++);
     }
 
     // computes y = x1 + alpha2*x2 + alpha3*x3 + alpha4*x4 + alpha5*x5
@@ -205,14 +199,13 @@
                            T alpha5 ,
                            InputIterator5 x5_begin )
     {
- typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
         while( y_begin != y_end )
             (*y_begin++) =
- alpha1 * static_cast<value_type>(*x1_begin++) +
- alpha2 * static_cast<value_type>(*x2_begin++) +
- alpha3 * static_cast<value_type>(*x3_begin++) +
- alpha4 * static_cast<value_type>(*x4_begin++) +
- alpha5 * static_cast<value_type>(*x5_begin++);
+ alpha1 * (*x1_begin++) +
+ alpha2 * (*x2_begin++) +
+ alpha3 * (*x3_begin++) +
+ alpha4 * (*x4_begin++) +
+ alpha5 * (*x5_begin++);
     }
 
 
@@ -243,15 +236,14 @@
                            T alpha6 ,
                            InputIterator6 x6_begin )
     {
- typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
         while( y_begin != y_end )
             (*y_begin++) =
- alpha1 * static_cast<value_type>(*x1_begin++) +
- alpha2 * static_cast<value_type>(*x2_begin++) +
- alpha3 * static_cast<value_type>(*x3_begin++) +
- alpha4 * static_cast<value_type>(*x4_begin++) +
- alpha5 * static_cast<value_type>(*x5_begin++) +
- alpha6 * static_cast<value_type>(*x6_begin++);
+ alpha1 * (*x1_begin++) +
+ alpha2 * (*x2_begin++) +
+ alpha3 * (*x3_begin++) +
+ alpha4 * (*x4_begin++) +
+ alpha5 * (*x5_begin++) +
+ alpha6 * (*x6_begin++);
     }
 
 
@@ -286,16 +278,15 @@
                            InputIterator7 x7_begin )
 
     {
- typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
         while( y_begin != y_end )
             (*y_begin++) =
- alpha1 * static_cast<value_type>(*x1_begin++) +
- alpha2 * static_cast<value_type>(*x2_begin++) +
- alpha3 * static_cast<value_type>(*x3_begin++) +
- alpha4 * static_cast<value_type>(*x4_begin++) +
- alpha5 * static_cast<value_type>(*x5_begin++) +
- alpha6 * static_cast<value_type>(*x6_begin++) +
- alpha7 * static_cast<value_type>(*x7_begin++) ;
+ alpha1 * (*x1_begin++) +
+ alpha2 * (*x2_begin++) +
+ alpha3 * (*x3_begin++) +
+ alpha4 * (*x4_begin++) +
+ alpha5 * (*x5_begin++) +
+ alpha6 * (*x6_begin++) +
+ alpha7 * (*x7_begin++) ;
     }
 
 
@@ -333,17 +324,16 @@
                            T alpha8 ,
                            InputIterator8 x8_begin )
     {
- typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
         while( y_begin != y_end )
             (*y_begin++) =
- alpha1 * static_cast<value_type>(*x1_begin++) +
- alpha2 * static_cast<value_type>(*x2_begin++) +
- alpha3 * static_cast<value_type>(*x3_begin++) +
- alpha4 * static_cast<value_type>(*x4_begin++) +
- alpha5 * static_cast<value_type>(*x5_begin++) +
- alpha6 * static_cast<value_type>(*x6_begin++) +
- alpha7 * static_cast<value_type>(*x7_begin++) +
- alpha8 * static_cast<value_type>(*x8_begin++);
+ alpha1 * (*x1_begin++) +
+ alpha2 * (*x2_begin++) +
+ alpha3 * (*x3_begin++) +
+ alpha4 * (*x4_begin++) +
+ alpha5 * (*x5_begin++) +
+ alpha6 * (*x6_begin++) +
+ alpha7 * (*x7_begin++) +
+ alpha8 * (*x8_begin++);
     }
 
     // computes y = x1 + alpha2*x2 + alpha3*x3 + alpha4*x4 + alpha5*x5
@@ -382,18 +372,17 @@
                            T alpha9 ,
                            InputIterator9 x9_begin )
     {
- typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
         while( y_begin != y_end )
             (*y_begin++) =
- alpha1 * static_cast<value_type>(*x1_begin++) +
- alpha2 * static_cast<value_type>(*x2_begin++) +
- alpha3 * static_cast<value_type>(*x3_begin++) +
- alpha4 * static_cast<value_type>(*x4_begin++) +
- alpha5 * static_cast<value_type>(*x5_begin++) +
- alpha6 * static_cast<value_type>(*x6_begin++) +
- alpha7 * static_cast<value_type>(*x7_begin++) +
- alpha8 * static_cast<value_type>(*x8_begin++) +
- alpha9 * static_cast<value_type>(*x9_begin++);
+ alpha1 * (*x1_begin++) +
+ alpha2 * (*x2_begin++) +
+ alpha3 * (*x3_begin++) +
+ alpha4 * (*x4_begin++) +
+ alpha5 * (*x5_begin++) +
+ alpha6 * (*x6_begin++) +
+ alpha7 * (*x7_begin++) +
+ alpha8 * (*x8_begin++) +
+ alpha9 * (*x9_begin++);
     }
 
 
@@ -439,19 +428,18 @@
                            InputIterator10 x10_begin
         )
     {
- typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
         while( y_begin != y_end )
             (*y_begin++) =
- alpha1 * static_cast<value_type>(*x1_begin++) +
- alpha2 * static_cast<value_type>(*x2_begin++) +
- alpha3 * static_cast<value_type>(*x3_begin++) +
- alpha4 * static_cast<value_type>(*x4_begin++) +
- alpha5 * static_cast<value_type>(*x5_begin++) +
- alpha6 * static_cast<value_type>(*x6_begin++) +
- alpha7 * static_cast<value_type>(*x7_begin++) +
- alpha8 * static_cast<value_type>(*x8_begin++) +
- alpha9 * static_cast<value_type>(*x9_begin++) +
- alpha10 * static_cast<value_type>(*x10_begin++);
+ alpha1 * (*x1_begin++) +
+ alpha2 * (*x2_begin++) +
+ alpha3 * (*x3_begin++) +
+ alpha4 * (*x4_begin++) +
+ alpha5 * (*x5_begin++) +
+ alpha6 * (*x6_begin++) +
+ alpha7 * (*x7_begin++) +
+ alpha8 * (*x8_begin++) +
+ alpha9 * (*x9_begin++) +
+ alpha10 * (*x10_begin++);
     }
 
 


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