From: Mikko Rasa Date: Sun, 19 May 2013 17:38:22 +0000 (+0300) Subject: Don't qualify potentially overloaded functions with the std namespace X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b24bbb85291644791a3206ff7f0ab0308faeadc9;p=libs%2Fmath.git Don't qualify potentially overloaded functions with the std namespace Instead put a using std::func before the call. This makes things work if the template argument is a user-defined type with these functions defined in another namespace. --- diff --git a/source/geometry/angle.h b/source/geometry/angle.h index 2cfb117..fbf6d06 100644 --- a/source/geometry/angle.h +++ b/source/geometry/angle.h @@ -198,49 +198,57 @@ inline Angle wrap_balanced(const Angle &a) template inline Angle abs(const Angle &angle) { - return Angle::from_radians(std::abs(angle.radians())); + using std::abs; + return Angle::from_radians(abs(angle.radians())); } template inline T sin(const Angle &angle) { - return std::sin(angle.radians()); + using std::sin; + return sin(angle.radians()); } template inline Angle asin(T s) { - return Angle::from_radians(std::asin(s)); + using std::asin; + return Angle::from_radians(asin(s)); } template inline T cos(const Angle &angle) { - return std::cos(angle.radians()); + using std::cos; + return cos(angle.radians()); } template inline Angle acos(T s) { - return Angle::from_radians(std::acos(s)); + using std::acos; + return Angle::from_radians(acos(s)); } template inline T tan(const Angle &angle) { - return std::tan(angle.radians()); + using std::tan; + return tan(angle.radians()); } template inline Angle atan(T s) { - return Angle::from_radians(std::atan(s)); + using std::atan; + return Angle::from_radians(atan(s)); } template inline Angle atan2(T y, T x) { - return Angle::from_radians(std::atan2(y, x)); + using std::atan2; + return Angle::from_radians(atan2(y, x)); } } // namespace Geometry diff --git a/source/linal/matrix.h b/source/linal/matrix.h index 83a64f5..6c04454 100644 --- a/source/linal/matrix.h +++ b/source/linal/matrix.h @@ -189,8 +189,9 @@ inline bool operator==(const Matrix &a, const Matrix &b) template inline Matrix &Matrix::exchange_rows(unsigned i, unsigned j) { + using std::swap; for(unsigned k=0; k