File indexing completed on 2026-08-06 09:25:33
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef NINJA_ZERO_FLOAT_HH
0015 #define NINJA_ZERO_FLOAT_HH
0016
0017 #include <iostream>
0018
0019 namespace ninja {
0020
0021 class ZeroFloat {
0022 public:
0023 ZeroFloat() {}
0024
0025
0026 ZeroFloat operator + () const
0027 {
0028 return ZeroFloat();
0029 }
0030
0031
0032 ZeroFloat operator - () const
0033 {
0034 return ZeroFloat();
0035 }
0036
0037 private:
0038
0039 };
0040
0041
0042
0043 template<typename T>
0044 inline bool operator == (ZeroFloat, const T & x)
0045 {
0046 return (x==T(0));
0047 }
0048 template<typename T>
0049 inline bool operator == (const T & x, ZeroFloat)
0050 {
0051 return (x==T(0));
0052 }
0053 template<typename T>
0054 inline bool operator != (ZeroFloat, const T & x)
0055 {
0056 return (x!=T(0));
0057 }
0058 template<typename T>
0059 inline bool operator != (const T & x, ZeroFloat)
0060 {
0061 return (x!=T(0));
0062 }
0063 template<typename T>
0064 inline bool operator < (ZeroFloat, const T & x)
0065 {
0066 return (x>T(0));
0067 }
0068 template<typename T>
0069 inline bool operator < (const T & x, ZeroFloat)
0070 {
0071 return (x<T(0));
0072 }
0073
0074
0075
0076 inline std::ostream & operator << (std::ostream & os, ZeroFloat)
0077 {
0078 return os << "(zero)";
0079 }
0080
0081
0082
0083 class ZeroFloatArray {
0084
0085 public:
0086
0087 ZeroFloatArray() {}
0088
0089 template<typename T> ZeroFloatArray(const T *) {}
0090
0091 ZeroFloat operator [] (int)
0092 {
0093 return ZeroFloat();
0094 }
0095
0096 private:
0097
0098 };
0099
0100
0101 namespace details {
0102
0103
0104 template <typename MassType>
0105 struct MasslessTypeError {};
0106 template <>
0107 struct MasslessTypeError<ZeroFloat> {
0108 static void MassType_must_be_massless() {}
0109 };
0110
0111 }
0112
0113 }
0114
0115 #endif