Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:19

0001 #ifndef NPSTAT_COMPLEXCOMPARESFALSE_HH_
0002 #define NPSTAT_COMPLEXCOMPARESFALSE_HH_
0003 
0004 /*!
0005 // \file ComplexComparesFalse.h
0006 //
0007 // \brief Ordering extended to complex numbers by always returning "false"
0008 //
0009 // Author: I. Volobouev
0010 //
0011 // January 2012
0012 */
0013 
0014 #include <complex>
0015 
0016 namespace npstat {
0017   /**
0018     // This template compares two numbers. For simple numeric types
0019     // (int, double, etc) the numbers themselves are compared while for
0020     // std::complex<...> types "false" is returned for every comparison.
0021     */
0022   template <class T>
0023   struct ComplexComparesFalse {
0024     inline static bool less(const T& l, const T& r) { return l < r; }
0025 
0026     inline static bool more(const T& l, const T& r) { return l > r; }
0027   };
0028 
0029   template <class T>
0030   struct ComplexComparesFalse<std::complex<T> > {
0031     inline static bool less(const std::complex<T>&, const std::complex<T>&) { return false; }
0032 
0033     inline static bool more(const std::complex<T>&, const std::complex<T>&) { return false; }
0034   };
0035 }  // namespace npstat
0036 
0037 #endif  // NPSTAT_COMPLEXCOMPARESFALSE_HH_