utils.H

Go to the documentation of this file.
00001 #ifndef utils_dot_H_header
00002 #define utils_dot_H_header
00003 
00010 // helper for debugging sessions ;-)
00011 #define MARK  std::cout << "now in " << __FILE__ << ", " << __FUNCTION__ << ": line " <<  __LINE__ << std::endl;
00012 
00013 
00014 // define templates for MIN and MAX:
00015 template<typename T> inline T MIN(const T a, const T b) { return (a<=b) ? a : b; }
00016 template<typename T> inline T MAX(const T a, const T b) { return (a>=b) ? a : b; }
00017 
00018 
00026 class ForbidAssignment
00027 {
00028  public:
00029   inline ForbidAssignment() { }
00030  private:
00031   ForbidAssignment(const ForbidAssignment&); // declaration intentionally without implementation!
00032   inline const ForbidAssignment& operator= (const ForbidAssignment&) const { return *this; }
00033   // only a dummy declaration/definition to forbid any implicit inherited use
00034   // of the assignment operator
00035 };
00036 
00037 
00038 #if (__GNUC__ == 3) && (__GNUC_MINOR__ < 4)
00039 // gcc 3.3.x and probably versions below seem to need a mechanism to avoid
00040 // ambiguity between "long double sqrt(long double)" and "double
00041 // sqrt(double)" when argument is an integer type. We could define them
00042 // directly for the integer types involved (but if we use "long long" in
00043 // advance, we would get compile errors on compilers that do not support
00044 // these types.)
00045 // so, hmmm, yeah: let's define the affected functions as templates
00046 
00047 template<typename T> inline double sqrt(const T x)
00048 {
00049   return std::sqrt(static_cast<double>(x));
00050 } 
00051 template<typename T> inline double log(const T x)
00052 {
00053   return std::log(static_cast<double>(x));
00054 }
00055 #endif
00056 
00057 
00058 #endif

Generated on Wed Nov 7 23:29:26 2007 for Qsieve by  doxygen 1.5.4