LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
pointersEqual.h
Go to the documentation of this file.
1
#ifndef art_Utilities_pointersEqual_h
2
#define art_Utilities_pointersEqual_h
3
// Compare two pointers taking into account possible multiple inheritance
4
5
#include "
canvas/Utilities/Exception.h
"
6
7
#include <type_traits>
8
9
namespace
art
{
10
template
<
typename
T1,
typename
T2>
11
inline
std::enable_if_t<std::is_same<T1, T2>::value
||
12
std::is_base_of<T1, T2>::value
||
13
std::is_base_of<T2, T1>::value
,
14
bool
>
15
pointersEqual
(T1*
t1
, T2*
t2
)
16
{
17
return
t1 ==
t2
;
18
}
19
20
// Not compatible.
21
template
<
typename
T1,
typename
T2>
22
std::enable_if_t<!std::is_same<T1, T2>::value
&&
23
!
std::is_base_of<T1, T2>::value
&&
24
!
std::is_base_of<T2, T1>::value
,
25
bool
>
26
pointersEqual
(T1*, T2*)
27
{
28
throw
art::Exception
(
art::errors::LogicError
)
29
<<
"Tried to compare two incompatible pointers.\n"
;
30
}
31
}
32
33
#endif
/* art_Utilities_pointersEqual_h */
34
35
// Local Variables:
36
// mode: c++
37
// End:
t1
TTree * t1
Definition:
plottest35.C:26
art::errors::LogicError
Definition:
Exception.h:33
art::pointersEqual
std::enable_if_t< std::is_same< T1, T2 >::value||std::is_base_of< T1, T2 >::value||std::is_base_of< T2, T1 >::value, bool > pointersEqual(T1 *t1, T2 *t2)
Definition:
pointersEqual.h:15
t2
TTree * t2
Definition:
plottest35.C:36
art::Exception
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition:
Exception.h:66
fhicl::detail::atom::value
std::string value(boost::any const &)
Definition:
printing_helpers.cc:97
art
HLT enums.
Definition:
ServiceProviderWrappers.h:36
Exception.h
art
Utilities
pointersEqual.h
Generated on Wed Dec 12 2018 14:42:34 for LArSoft by
1.8.11