Ticket #2186: adl_problem.patch

File adl_problem.patch, 1.5 KB (added by thomas.klimpel@…, 14 years ago)

a possible fix for the compile error

  • traits.hpp

     
    2424#include <boost/type_traits.hpp>
    2525#include <complex>
    2626
     27// anonymous namespace to avoid ADL issues
     28namespace {
     29  template<class T> T boost_numeric_ublas_sqrt (const T& t) {
     30    using namespace std;
     31    // we'll find either std::sqrt or else another version via ADL:
     32    return sqrt (t);
     33  }
     34  template<class T> T boost_numeric_ublas_abs (const T& t) {
     35    using namespace std;
     36    // we'll find either std::abs or else another version via ADL:
     37    return abs (t);
     38  }
     39}
     40
    2741namespace boost { namespace numeric { namespace ublas {
    2842
    2943    // Use Joel de Guzman's return type deduction
     
    8498        static
    8599        BOOST_UBLAS_INLINE
    86100        real_type type_abs (const_reference t) {
    87             // we'll find either std::abs or else another version via ADL:
    88             using namespace std;
    89             return abs (t);
     101            return boost_numeric_ublas_abs (t);
    90102        }
    91103        static
    92104        BOOST_UBLAS_INLINE
    93105        value_type type_sqrt (const_reference t) {
    94             using namespace std;
    95106            // force a type conversion back to value_type for intgral types
    96             // we'll find either std::sqrt or else another version via ADL:
    97             return value_type (sqrt (t));
     107            return value_type (boost_numeric_ublas_sqrt (t));
    98108        }
    99109
    100110        static