File indexing completed on 2024-04-06 12:31:27
0001 #ifndef TrackingTools_DetLayers_rangesIntersect_h
0002 #define TrackingTools_DetLayers_rangesIntersect_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #if defined(__clang__) && defined(__has_warning)
0017 #if __has_warning("-Wbitwise-instead-of-logical")
0018 #pragma clang diagnostic push
0019 #pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
0020 #endif
0021 #endif
0022
0023 template <typename Range>
0024 inline bool rangesIntersect(const Range& a, const Range& b) {
0025 return !((a.first > b.second) | (b.first > a.second));
0026 }
0027
0028 template <typename Range, typename Less>
0029 inline bool rangesIntersect(const Range& a, const Range& b, Less const& less) {
0030 return !(less(b.second, a.first) | less(a.second, b.first));
0031 }
0032 template <typename Range, typename T>
0033 inline bool rangesIntersect(const Range& a, const Range& b, bool (*less)(T, T)) {
0034 return !(less(b.second, a.first) | less(a.second, b.first));
0035 }
0036
0037 #if defined(__clang__) && defined(__has_warning)
0038 #if __has_warning("-Wbitwise-instead-of-logical")
0039 #pragma clang diagnostic pop
0040 #endif
0041 #endif
0042
0043 #endif