• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #ifndef SUPPORT_USER_DEFINED_INTEGRAL_HPP
10 #define SUPPORT_USER_DEFINED_INTEGRAL_HPP
11 
12 template <class T>
13 struct UserDefinedIntegral
14 {
UserDefinedIntegralUserDefinedIntegral15     UserDefinedIntegral() : value(0) {}
UserDefinedIntegralUserDefinedIntegral16     UserDefinedIntegral(T v) : value(v) {}
operator TUserDefinedIntegral17     operator T() const { return value; }
18     T value;
19 };
20 
21 // Poison the arithmetic and comparison operations
22 template <class T, class U>
23 void operator+(UserDefinedIntegral<T>, UserDefinedIntegral<U>);
24 
25 template <class T, class U>
26 void operator-(UserDefinedIntegral<T>, UserDefinedIntegral<U>);
27 
28 template <class T, class U>
29 void operator*(UserDefinedIntegral<T>, UserDefinedIntegral<U>);
30 
31 template <class T, class U>
32 void operator/(UserDefinedIntegral<T>, UserDefinedIntegral<U>);
33 
34 template <class T, class U>
35 void operator==(UserDefinedIntegral<T>, UserDefinedIntegral<U>);
36 
37 template <class T, class U>
38 void operator!=(UserDefinedIntegral<T>, UserDefinedIntegral<U>);
39 
40 template <class T, class U>
41 void operator<(UserDefinedIntegral<T>, UserDefinedIntegral<U>);
42 
43 template <class T, class U>
44 void operator>(UserDefinedIntegral<T>, UserDefinedIntegral<U>);
45 
46 template <class T, class U>
47 void operator<=(UserDefinedIntegral<T>, UserDefinedIntegral<U>);
48 
49 template <class T, class U>
50 void operator>=(UserDefinedIntegral<T>, UserDefinedIntegral<U>);
51 
52 #endif // SUPPORT_USER_DEFINED_INTEGRAL_HPP
53