Boost logo

Boost-Commit :

From: guwi17_at_[hidden]
Date: 2008-08-28 17:49:06


Author: guwi17
Date: 2008-08-28 17:49:05 EDT (Thu, 28 Aug 2008)
New Revision: 48427
URL: http://svn.boost.org/trac/boost/changeset/48427

Log:
- fix and close #2186
- the patch looks good and runs fine with gcc 4.1.2

Text files modified:
   trunk/boost/numeric/ublas/traits.hpp | 22 ++++++++++++++++------
   1 files changed, 16 insertions(+), 6 deletions(-)

Modified: trunk/boost/numeric/ublas/traits.hpp
==============================================================================
--- trunk/boost/numeric/ublas/traits.hpp (original)
+++ trunk/boost/numeric/ublas/traits.hpp 2008-08-28 17:49:05 EDT (Thu, 28 Aug 2008)
@@ -24,6 +24,20 @@
 #include <boost/type_traits.hpp>
 #include <complex>
 
+// anonymous namespace to avoid ADL issues
+namespace {
+ template<class T> T boost_numeric_ublas_sqrt (const T& t) {
+ using namespace std;
+ // we'll find either std::sqrt or else another version via ADL:
+ return sqrt (t);
+ }
+ template<class T> T boost_numeric_ublas_abs (const T& t) {
+ using namespace std;
+ // we'll find either std::abs or else another version via ADL:
+ return abs (t);
+ }
+}
+
 namespace boost { namespace numeric { namespace ublas {
 
     // Use Joel de Guzman's return type deduction
@@ -84,17 +98,13 @@
         static
         BOOST_UBLAS_INLINE
         real_type type_abs (const_reference t) {
- // we'll find either std::abs or else another version via ADL:
- using namespace std;
- return abs (t);
+ return boost_numeric_ublas_abs (t);
         }
         static
         BOOST_UBLAS_INLINE
         value_type type_sqrt (const_reference t) {
- using namespace std;
             // force a type conversion back to value_type for intgral types
- // we'll find either std::sqrt or else another version via ADL:
- return value_type (sqrt (t));
+ return value_type (boost_numeric_ublas_sqrt (t));
         }
 
         static


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