predicate.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: predicate.h,v 1.15 2005/12/23 17:01:41 amoll Exp $
00005 //
00006 
00007 #ifndef BALL_CONCEPT_PREDICATE_H
00008 #define BALL_CONCEPT_PREDICATE_H
00009 
00010 #ifndef BALL_COMMON_GLOBAL_H
00011 # include <BALL/COMMON/global.h>
00012 #endif
00013 
00014 #include <functional>
00015 
00016 namespace BALL 
00017 {
00018   using std::unary_function;
00019   using std::binary_function;
00020     
00026   
00029   template <typename T> 
00030   class UnaryPredicate 
00031     : public unary_function<T, bool> 
00032   {
00033     public:
00035     virtual ~UnaryPredicate() {}
00036 
00038     virtual bool operator() (const T& /* x */) const
00039       ;
00040   };
00041 
00044   template <typename T1, typename T2> 
00045   class BinaryPredicate 
00046     : public binary_function<T1, T2, bool> 
00047   {
00048     public:
00049 
00051     virtual bool operator() (const T1& x, const T2& y) const
00052       ;
00053 
00055     virtual ~BinaryPredicate() {}
00056   };
00057 
00058   template <typename T> 
00059   bool UnaryPredicate<T>::operator() (const T& /* x */) const
00060     
00061   {
00062     return true;
00063   }
00064 
00065   template <typename T1, typename T2> 
00066   bool BinaryPredicate<T1, T2>::operator() (const T1&, const T2&) const
00067     
00068   {
00069     return true;
00070   }
00072 } // namespace BALL
00073 
00074 
00075 #endif // BALL_CONCEPT_PREDICATE_H