BALL 1.5.0
Loading...
Searching...
No Matches
CONCEPT/predicate.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_CONCEPT_PREDICATE_H
6#define BALL_CONCEPT_PREDICATE_H
7
8#ifndef BALL_COMMON_GLOBAL_H
9# include <BALL/COMMON/global.h>
10#endif
11
12#include <functional>
13
14namespace BALL
15{
16 using std::unary_function;
17 using std::binary_function;
18
24
27 template <typename T>
29 : public unary_function<T, bool>
30 {
31 public:
33 virtual ~UnaryPredicate() {}
34
36 virtual bool operator() (const T& /* x */) const
37 ;
38 };
39
42 template <typename T1, typename T2>
44 : public binary_function<T1, T2, bool>
45 {
46 public:
47
49 virtual bool operator() (const T1& x, const T2& y) const
50 ;
51
53 virtual ~BinaryPredicate() {}
54 };
55
56 template <typename T>
57 bool UnaryPredicate<T>::operator() (const T& /* x */) const
58
59 {
60 return true;
61 }
62
63 template <typename T1, typename T2>
64 bool BinaryPredicate<T1, T2>::operator() (const T1&, const T2&) const
65
66 {
67 return true;
68 }
70} // namespace BALL
71
72
73#endif // BALL_CONCEPT_PREDICATE_H
virtual bool operator()(const T &) const
virtual bool operator()(const T1 &x, const T2 &y) const