00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <mln/trait/op/uminus.hh>
00027 #include <mln/core/concept/object.hh>
00028 #include <mln/value/int_u8.hh>
00029
00030
00031 namespace my
00032 {
00033
00034
00035
00036
00037 template <typename E> struct Value;
00038
00039 template <> struct Value<void> { typedef mln::Object<void> super; };
00040
00041 template <typename E>
00042 struct Value
00043 {
00044 typedef Value<void> category;
00045 protected:
00046 Value() {}
00047 };
00048
00049
00050
00051
00052 template <typename E> struct Integer;
00053
00054 template <> struct Integer<void> { typedef Value<void> super; };
00055
00056 template <typename E>
00057 struct Integer
00058 {
00059 typedef Integer<void> category;
00060 };
00061
00062 template <>
00063 struct Integer<int>
00064 {
00065 typedef Integer<void> category;
00066 int i;
00067 Integer(int i) : i(i) {}
00068 };
00069
00070
00071
00072
00073 template <typename E> struct Built_In;
00074
00075 template <> struct Built_In<void> { typedef void* super; };
00076
00077
00078
00079
00080 struct test
00081 {
00082 void is_test() {}
00083 };
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 }
00099
00100
00101
00102 namespace mln
00103 {
00104
00105 template <>
00106 struct category< my::test >
00107 {
00108 typedef my::Built_In< my::Integer<void> > ret;
00109 };
00110
00111
00112
00113
00114
00115
00116
00117 namespace trait
00118 {
00119
00120 template <typename T>
00121 struct set_unary_< op::uminus, my::Integer, T >
00122 {
00123 typedef bool ret;
00124 };
00125
00126 }
00127
00128 }
00129
00130
00131 int main()
00132 {
00133 using namespace mln;
00134
00135 mln_trait_op_uminus_(my::test) tmp;
00136 tmp = true;
00137
00138
00139
00140
00141
00142
00143 }