#ifndef FUNCTION_H_ #define FUNCTION_H_ #include "StartConv.h" // The less function template. template class less { public: bool operator() ( const Object & lhs, const Object & rhs ) const { return lhs < rhs; } }; // The greater function template. template class greater { public: bool operator() ( const Object & lhs, const Object & rhs ) const { return lhs > rhs; } }; // The equal_to function template. template class equal_to { public: bool operator() ( const Object & lhs, const Object & rhs ) const { return lhs == rhs; } }; // The Bind1stClass. template class Bind1stClass { public: Bind1stClass( BinaryPredicate pred, const Object & fv ) : predicate( pred ), firstVal( fv ) { } bool operator( ) ( const Object & x ) const { return predicate( firstVal, x ); } private: BinaryPredicate predicate; Object firstVal; }; // The bind1st function template. template Bind1stClass bind1st( BinaryPredicate pred, Object x ) { return Bind1stClass( pred, x ); } // The Bind2ndClass. template class Bind2ndClass { public: Bind2ndClass( BinaryPredicate pred, const Object & sv ) : predicate( pred ), secondVal( sv ) { } bool operator( ) ( const Object & x ) const { return predicate( x, secondVal ); } private: BinaryPredicate predicate; Object secondVal; }; // The bind2nd function template. template Bind2ndClass bind2nd( BinaryPredicate pred, Object x ) { return Bind2ndClass( pred, x ); } #include "EndConv.h" #endif