unary.h

00001 #ifndef _unary_h
00002 #define _unary_h
00003 #include <cmath>
00004 #include <cfloat>
00005 #include <functional>           //*TY 12/26/1998 - added to get unary_function
00006 
00007 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
00008 using std::unary_function;
00009 #endif
00010 
00011 struct odd : public unary_function<int, bool>
00012 {
00013 //  odd() {}
00014   bool operator()(int n_) const { return(n_ % 2) == 1; }
00015 };
00016  
00017 struct positive : public unary_function<int, bool>
00018 {
00019   typedef int argument_type;
00020   typedef bool result_type;
00021 //  positive() {}
00022   bool operator()(int n_) const { return n_ >= 0; }
00023 };
00024 
00025 struct square_root : public unary_function<double, double>
00026 {
00027   typedef double argument_type;
00028   typedef double result_type;
00029   square_root() {}
00030   square_root(const square_root &) {}
00031   double operator()(double x_) const { 
00032   # if !defined(STLPORT) || defined (__STL_USE_NAMESPACES)
00033     using namespace std;
00034   # endif
00035     return sqrt(x_); 
00036   }
00037 };
00038 #endif // _unary_h

Generated on Mon Jun 5 10:20:48 2006 for Intelligence.kdevelop by  doxygen 1.4.6