1 #ifndef SUPPORT_USER_DEFINED_INTEGRAL_HPP 2 #define SUPPORT_USER_DEFINED_INTEGRAL_HPP 3 4 template <class T> 5 struct UserDefinedIntegral 6 { 7 UserDefinedIntegral() : value(0) {} 8 UserDefinedIntegral(T v) : value(v) {} 9 operator T() const { return value; } 10 T value; 11 }; 12 13 // Poison the arithmetic and comparison operations 14 template <class T, class U> 15 void operator+(UserDefinedIntegral<T>, UserDefinedIntegral<U>); 16 17 template <class T, class U> 18 void operator-(UserDefinedIntegral<T>, UserDefinedIntegral<U>); 19 20 template <class T, class U> 21 void operator*(UserDefinedIntegral<T>, UserDefinedIntegral<U>); 22 23 template <class T, class U> 24 void operator/(UserDefinedIntegral<T>, UserDefinedIntegral<U>); 25 26 template <class T, class U> 27 void operator==(UserDefinedIntegral<T>, UserDefinedIntegral<U>); 28 29 template <class T, class U> 30 void operator!=(UserDefinedIntegral<T>, UserDefinedIntegral<U>); 31 32 template <class T, class U> 33 void operator<(UserDefinedIntegral<T>, UserDefinedIntegral<U>); 34 35 template <class T, class U> 36 void operator>(UserDefinedIntegral<T>, UserDefinedIntegral<U>); 37 38 template <class T, class U> 39 void operator<=(UserDefinedIntegral<T>, UserDefinedIntegral<U>); 40 41 template <class T, class U> 42 void operator>=(UserDefinedIntegral<T>, UserDefinedIntegral<U>); 43 44 #endif // SUPPORT_USER_DEFINED_INTEGRAL_HPP 45