Boost logo

Boost-Commit :

From: guwi17_at_[hidden]
Date: 2007-11-15 15:52:38


Author: guwi17
Date: 2007-11-15 15:52:37 EST (Thu, 15 Nov 2007)
New Revision: 41116
URL: http://svn.boost.org/trac/boost/changeset/41116

Log:
This patch now lets the Sun compiler work for most of uBLAS. 'test4' is now failing.
Too avoid other compilers complaining about missing return values in some functions where exceptions are thrown, code was added so an arbitatry were chosen.

Text files modified:
   trunk/boost/numeric/ublas/banded.hpp | 21 ++++++++++++---------
   trunk/boost/numeric/ublas/hermitian.hpp | 10 ++++------
   trunk/boost/numeric/ublas/triangular.hpp | 32 +++++++++-----------------------
   3 files changed, 25 insertions(+), 38 deletions(-)

Modified: trunk/boost/numeric/ublas/banded.hpp
==============================================================================
--- trunk/boost/numeric/ublas/banded.hpp (original)
+++ trunk/boost/numeric/ublas/banded.hpp 2007-11-15 15:52:37 EST (Thu, 15 Nov 2007)
@@ -175,21 +175,24 @@
 #ifdef BOOST_UBLAS_OWN_BANDED
             const size_type k = (std::max) (i, j);
             const size_type l = lower_ + j - i;
- if (k < (std::max) (size1_, size2_) &&
- l < lower_ + 1 + upper_)
- return data () [layout_type::element (k, (std::max) (size1_, size2_),
+ if (! (k < (std::max) (size1_, size2_) &&
+ l < lower_ + 1 + upper_) ) {
+ bad_index ().raise ();
+ // NEVER reached
+ }
+ return data () [layout_type::element (k, (std::max) (size1_, size2_),
                                                        l, lower_ + 1 + upper_)];
 #else
             const size_type k = j;
             const size_type l = upper_ + i - j;
- if (k < size2_ &&
- l < lower_ + 1 + upper_)
- return data () [layout_type::element (k, size2_,
+ if (! (k < size2_ &&
+ l < lower_ + 1 + upper_) ) {
+ bad_index ().raise ();
+ // NEVER reached
+ }
+ return data () [layout_type::element (k, size2_,
                                                        l, lower_ + 1 + upper_)];
 #endif
- bad_index ().raise ();
- // arbitary return value
- return const_cast<reference>(zero_);
         }
 
         // Element assignment

Modified: trunk/boost/numeric/ublas/hermitian.hpp
==============================================================================
--- trunk/boost/numeric/ublas/hermitian.hpp (original)
+++ trunk/boost/numeric/ublas/hermitian.hpp 2007-11-15 15:52:37 EST (Thu, 15 Nov 2007)
@@ -354,13 +354,11 @@
         BOOST_UBLAS_INLINE
         reference operator () (size_type i, size_type j) {
 #ifndef BOOST_UBLAS_STRICT_HERMITIAN
- if (triangular_type::other (i, j))
- return at_element (i, j);
- else {
- external_logic ().raise ();
- // arbitary return value
- return data () [triangular_type::element (layout_type (), j, size_, i, size_)];
+ if (!triangular_type::other (i, j)) {
+ bad_index ().raise ();
+ // NEVER reached
             }
+ return at_element (i, j);
 #else
         if (triangular_type::other (i, j))
             return reference (*this, i, j, data () [triangular_type::element (layout_type (), i, size_, j, size_)]);

Modified: trunk/boost/numeric/ublas/triangular.hpp
==============================================================================
--- trunk/boost/numeric/ublas/triangular.hpp (original)
+++ trunk/boost/numeric/ublas/triangular.hpp 2007-11-15 15:52:37 EST (Thu, 15 Nov 2007)
@@ -173,13 +173,11 @@
         reference operator () (size_type i, size_type j) {
             BOOST_UBLAS_CHECK (i < size1_, bad_index ());
             BOOST_UBLAS_CHECK (j < size2_, bad_index ());
- if (triangular_type::other (i, j))
- return data () [triangular_type::element (layout_type (), i, size1_, j, size2_)];
- else {
+ if (!triangular_type::other (i, j)) {
                 bad_index ().raise ();
- // arbitary return value
- return const_cast<reference>(zero_);
+ // NEVER reached
             }
+ return data () [triangular_type::element (layout_type (), i, size1_, j, size2_)];
         }
         
         // Element assignment
@@ -1019,34 +1017,22 @@
         reference operator () (size_type i, size_type j) {
             BOOST_UBLAS_CHECK (i < size1 (), bad_index ());
             BOOST_UBLAS_CHECK (j < size2 (), bad_index ());
- if (triangular_type::other (i, j))
- return data () (i, j);
- else if (triangular_type::one (i, j)) {
- bad_index ().raise ();
- // arbitary return value
- return const_cast<reference>(one_);
- } else {
+ if (!triangular_type::other (i, j)) {
                 bad_index ().raise ();
- // arbitary return value
- return const_cast<reference>(zero_);
+ // NEVER reached
             }
+ return data () (i, j);
         }
 #else
         BOOST_UBLAS_INLINE
         reference operator () (size_type i, size_type j) const {
             BOOST_UBLAS_CHECK (i < size1 (), bad_index ());
             BOOST_UBLAS_CHECK (j < size2 (), bad_index ());
- if (triangular_type::other (i, j))
- return data () (i, j);
- else if (triangular_type::one (i, j)) {
- bad_index ().raise ();
- // arbitary return value
- return const_cast<reference>(one_);
- } else {
+ if (!triangular_type::other (i, j)) {
                 bad_index ().raise ();
- // arbitary return value
- return const_cast<reference>(zero_);
+ // NEVER reached
             }
+ return data () (i, j);
         }
 #endif
 


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