$extrastylesheet
libmesh_augment_std_namespace.h
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 
00020 #ifndef LIBMESH_LIBMESH_AUGMENT_STD_NAMESPACE_H
00021 #define LIBMESH_LIBMESH_AUGMENT_STD_NAMESPACE_H
00022 
00023 
00024 // For some reason the real std::max, std::min
00025 // don't handle mixed compatible types
00026 namespace std {
00027 inline long double max(long double a, double b)
00028 { return (a>b?a:b); }
00029 inline long double min(long double a, double b)
00030 { return (a<b?a:b); }
00031 
00032 inline long double max(double a, long double b)
00033 { return (a>b?a:b); }
00034 inline long double min(double a, long double b)
00035 { return (a<b?a:b); }
00036 
00037 inline double max(double a, float b)
00038 { return (a>b?a:b); }
00039 inline double min(double a, float b)
00040 { return (a<b?a:b); }
00041 
00042 inline double max(float a, double b)
00043 { return (a>b?a:b); }
00044 inline double min(float a, double b)
00045 { return (a<b?a:b); }
00046 
00047 inline long double max(long double a, float b)
00048 { return (a>b?a:b); }
00049 inline long double min(long double a, float b)
00050 { return (a<b?a:b); }
00051 
00052 inline long double max(float a, long double b)
00053 { return (a>b?a:b); }
00054 inline long double min(float a, long double b)
00055 { return (a<b?a:b); }
00056 
00057 // fix for std::abs() overload ambiguity
00058 #if defined (__SUNPRO_CC) || defined(__PGI)
00059 inline double abs(double a)
00060 { return ::fabs(a); }
00061 
00062 #endif
00063 
00064 // fix for std::pow() overload ambiguity
00065 #if defined (__SUNPRO_CC)
00066 inline double pow(double a, int b)
00067 { return std::pow(a, static_cast<double>(b)); }
00068 #endif
00069 }
00070 
00071 #endif // #define LIBMESH_LIBMESH_AUGMENT_STD_NAMESPACE_H