From 378865614f908dcbbae99b3cddce01b704d60db9 Mon Sep 17 00:00:00 2001 From: Gunter Winkler Date: Thu, 28 Aug 2008 21:49:05 +0000 Subject: [PATCH] - fix and close #2186 - the patch looks good and runs fine with gcc 4.1.2 --- include/boost/numeric/ublas/traits.hpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/include/boost/numeric/ublas/traits.hpp b/include/boost/numeric/ublas/traits.hpp index f1e8e8e1..6e5c576f 100644 --- a/include/boost/numeric/ublas/traits.hpp +++ b/include/boost/numeric/ublas/traits.hpp @@ -24,6 +24,20 @@ #include #include +// anonymous namespace to avoid ADL issues +namespace { + template 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 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 @@ namespace boost { namespace numeric { namespace ublas { 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