Jpp
software
Jeep
JComparisonToolkit.hh
Go to the documentation of this file.
1
#ifndef __JEEP__JCOMPARISONTOOLKIT__
2
#define __JEEP__JCOMPARISONTOOLKIT__
3
4
#include "
JLang/JComparisonAvailable.hh
"
5
#include "
JLang/JBool.hh
"
6
7
8
/**
9
* \author mdejong
10
*/
11
12
namespace
JEEP
{}
13
namespace
JPP
{
using namespace
JEEP
; }
14
15
namespace
JEEP
{
16
17
using
JLANG::JComparisonAvailable
;
18
using
JLANG::JBool
;
19
20
21
22
/**
23
* Comparison of comparable objects.
24
*
25
* \param first first object
26
* \param second second object
27
* \return true if objects are equal; else false
28
*/
29
template
<
class
T>
30
inline
bool
compareObjects
(
const
T& first,
31
const
T& second,
32
JBool<true>
)
33
{
34
return
first == second;
35
}
36
37
38
/**
39
* Comparison of uncomparable objects.
40
*
41
* \param first first object
42
* \param second second object
43
* \return false
44
*/
45
template
<
class
T>
46
inline
bool
compareObjects
(
const
T& first,
47
const
T& second,
48
JBool<false>
)
49
{
50
return
false
;
51
}
52
53
54
/**
55
* Comparison of objects.
56
*
57
* \param first first object
58
* \param second second object
59
* \return true if objects are comparable and equal; else false
60
*/
61
template
<
class
T>
62
inline
bool
compareObjects
(
const
T& first,
63
const
T& second)
64
{
65
return
compareObjects
(first, second,
JBool
<
JComparisonAvailable<T>::has_eq
>());
66
}
67
}
68
69
#endif
JLANG::JLOCAL::JComparisonAvailable
Test availability of comparison operators of non-composite data types.
Definition:
JComparisonAvailable.hh:37
JBool.hh
JEEP
General puprpose classes and methods.
Definition:
JArgs.hh:15
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition:
JAAnetToolkit.hh:37
JLANG::JBool
Auxiliary template class for type bool.
Definition:
JBool.hh:20
JComparisonAvailable.hh
JLANG::JLOCAL::JComparisonAvailable::has_eq
static const bool has_eq
true if operator== available; else false
Definition:
JComparisonAvailable.hh:47
JEEP::compareObjects
bool compareObjects(const T &first, const T &second)
Comparison of objects.
Definition:
JComparisonToolkit.hh:62
Generated by
1.8.16