CMS 3D CMS Logo

rangesIntersect.h
Go to the documentation of this file.
1 #ifndef TrackingTools_DetLayers_rangesIntersect_h
2 #define TrackingTools_DetLayers_rangesIntersect_h
3 
13 // Disable bitwise-instead-of-logical warning, see discussion in
14 // https://github.com/cms-sw/cmssw/issues/39105
15 
16 #if defined(__clang__) && defined(__has_warning)
17 #if __has_warning("-Wbitwise-instead-of-logical")
18 #pragma clang diagnostic push
19 #pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
20 #endif
21 #endif
22 
23 template <typename Range>
24 inline bool rangesIntersect(const Range& a, const Range& b) {
25  return !((a.first > b.second) | (b.first > a.second));
26 }
27 
28 template <typename Range, typename Less>
29 inline bool rangesIntersect(const Range& a, const Range& b, Less const& less) {
30  return !(less(b.second, a.first) | less(a.second, b.first));
31 }
32 template <typename Range, typename T>
33 inline bool rangesIntersect(const Range& a, const Range& b, bool (*less)(T, T)) {
34  return !(less(b.second, a.first) | less(a.second, b.first));
35 }
36 
37 #if defined(__clang__) && defined(__has_warning)
38 #if __has_warning("-Wbitwise-instead-of-logical")
39 #pragma clang diagnostic pop
40 #endif
41 #endif
42 
43 #endif
PixelRecoRange< float > Range
bool rangesIntersect(const Range &a, const Range &b)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
long double T