Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JComparison.hh
Go to the documentation of this file.
1#ifndef __JLANG__JCOMPARISON__
2#define __JLANG__JCOMPARISON__
3
4
5/**
6 * \author mdejong
7 */
8
9namespace JLANG {}
10namespace JPP { using namespace JLANG; }
11
12namespace JLANG {
13
14 /**
15 * Functional implementations of comparison operators.
16 */
17 struct JComparison {
18 /**
19 * Equal.
20 *
21 * \param first first object
22 * \param second second object
23 * \return true if first object equal to second object; else false
24 */
25 struct eq {
26 template<class T>
27 bool operator()(const T& first, const T& second) const
28 {
29 return first == second;
30 }
31 };
32
33
34 /**
35 * Not equal.
36 *
37 * \param first first object
38 * \param second second object
39 * \return true if first object not equal to second object; else false
40 */
41 struct ne {
42 template<class T>
43 bool operator()(const T& first, const T& second) const
44 {
45 return first != second;
46 }
47 };
48
49
50 /**
51 * Less than.
52 *
53 * \param first first object
54 * \param second second object
55 * \return true if first object less than second object; else false
56 */
57 struct lt {
58 template<class T>
59 bool operator()(const T& first, const T& second) const
60 {
61 return first < second;
62 }
63 };
64
65
66 /**
67 * Greater than.
68 *
69 * \param first first object
70 * \param second second object
71 * \return true if first object greater than second object; else false
72 */
73 struct gt {
74 template<class T>
75 bool operator()(const T& first, const T& second) const
76 {
77 return first > second;
78 }
79 };
80
81
82 /**
83 * Less equals.
84 *
85 * \param first first object
86 * \param second second object
87 * \return true if first object less than or equal to second object; else false
88 */
89 struct le {
90 template<class T>
91 bool operator()(const T& first, const T& second) const
92 {
93 return first <= second;
94 }
95 };
96
97
98 /**
99 * Greater equals.
100 *
101 * \param first first object
102 * \param second second object
103 * \return true if first object greater than or equal to second object; else false
104 */
105 struct ge {
106 template<class T>
107 bool operator()(const T& first, const T& second) const
108 {
109 return first >= second;
110 }
111 };
112 };
113}
114
115#endif
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool operator()(const T &first, const T &second) const
bool operator()(const T &first, const T &second) const
bool operator()(const T &first, const T &second) const
bool operator()(const T &first, const T &second) const
bool operator()(const T &first, const T &second) const
bool operator()(const T &first, const T &second) const
Functional implementations of comparison operators.