1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cppstdlib/stl/test/unit/unary.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,34 @@
1.4 +#ifndef _unary_h
1.5 +#define _unary_h
1.6 +#include <cmath>
1.7 +#include <cfloat>
1.8 +#include <functional> //*TY 12/26/1998 - added to get unary_function
1.9 +
1.10 +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
1.11 +using std::unary_function;
1.12 +#endif
1.13 +
1.14 +struct odd : public unary_function<int, bool>
1.15 +{
1.16 +// odd() {}
1.17 + bool operator()(int n_) const { return(n_ % 2) == 1; }
1.18 +};
1.19 +
1.20 +struct positive : public unary_function<int, bool>
1.21 +{
1.22 + typedef int argument_type;
1.23 + typedef bool result_type;
1.24 +// positive() {}
1.25 + bool operator()(int n_) const { return n_ >= 0; }
1.26 +};
1.27 +
1.28 +struct square_root : public unary_function<double, double>
1.29 +{
1.30 + typedef double argument_type;
1.31 + typedef double result_type;
1.32 + square_root() {}
1.33 + square_root(const square_root &) {}
1.34 + double operator()(double x_) const
1.35 + { return ::sqrt(x_); }
1.36 +};
1.37 +#endif // _unary_h