26 #ifndef MLN_LITERAL_OPS_HH
27 # define MLN_LITERAL_OPS_HH
35 # include <mln/core/concept/literal.hh>
36 # include <mln/trait/all.hh>
37 # include <mln/metal/equal.hh>
38 # include <mln/metal/converts_to.hh>
49 template <
template <
class,
class>
class Name,
50 typename L,
typename O >
51 struct set_binary_< Name, mln::Literal, L,
mln::Object, O >
53 typedef mln_trait_binary(Name, O, O)
ret;
56 template < template <class, class> class Name,
57 typename O, typename L >
58 struct set_binary_< Name, mln::Object, O, mln::Literal, L >
60 typedef mln_trait_binary(Name, O, O) ret;
63 template < typename L1, typename L2 >
64 struct set_binary_< op::eq, mln::Literal, L1, mln::Literal, L2 >
69 template <
typename L1,
typename L2 >
80 template <
typename O,
typename L>
81 mln_trait_op_plus(O, O)
82 operator+(const Object<O>& lhs, const Literal<L>&
rhs);
84 template <typename L, typename O>
85 mln_trait_op_plus(O, O)
86 operator+(const Literal<L>& lhs, const Object<O>& rhs);
88 template <typename O, typename L>
89 mln_trait_op_minus(O, O)
90 operator-(const Object<O>& lhs, const Literal<L>& rhs);
92 template <typename L, typename O>
93 mln_trait_op_minus(O, O)
94 operator-(const Literal<L>& lhs, const Object<O>& rhs);
96 template <typename O, typename L>
97 mln_trait_op_times(O, O)
98 operator*(const Object<O>& lhs, const Literal<L>& rhs);
100 template <typename L, typename O>
101 mln_trait_op_times(O, O)
102 operator*(const Literal<L>& lhs, const Object<O>& rhs);
104 template <typename O, typename L>
105 mln_trait_op_div(O, O)
106 operator/(const Object<O>& lhs, const Literal<L>& rhs);
108 template <typename L, typename O>
109 mln_trait_op_div(O, O)
110 operator/(const Literal<L>& lhs, const Object<O>& rhs);
112 template <typename O, typename L>
113 mln_trait_op_mod(O, O)
114 operator%(const Object<O>& lhs, const Literal<L>& rhs);
116 template <typename L, typename O>
117 mln_trait_op_mod(O, O)
118 operator%(const Literal<L>& lhs, const Object<O>& rhs);
123 template <typename O, typename L>
125 operator==(const Object<O>& lhs, const Literal<L>& rhs);
127 template <typename L, typename O>
129 operator==(const Literal<L>& lhs, const Object<O>& rhs);
131 template <typename L1, typename L2>
132 bool operator==(const Literal<L1>& lhs, const Literal<L2>& rhs);
138 # ifndef MLN_INCLUDE_ONLY
146 template <
typename O,
typename L>
148 mln_trait_op_plus(O, O)
149 operator+(const Object<O>& lhs, const Literal<L>& rhs)
155 template <
typename L,
typename O>
157 mln_trait_op_plus(O, O)
158 operator+(const Literal<L>& lhs, const Object<O>& rhs)
166 template <
typename O,
typename L>
168 mln_trait_op_minus(O, O)
169 operator-(const Object<O>& lhs, const Literal<L>& rhs)
175 template <
typename L,
typename O>
177 mln_trait_op_minus(O, O)
178 operator-(const Literal<L>& lhs, const Object<O>& rhs)
186 template <
typename O,
typename L>
188 mln_trait_op_times(O, O)
189 operator*(const Object<O>& lhs, const Literal<L>& rhs)
195 template <
typename L,
typename O>
197 mln_trait_op_times(O, O)
198 operator*(const Literal<L>& lhs, const Object<O>& rhs)
206 template <
typename O,
typename L>
208 mln_trait_op_div(O, O)
209 operator/(const Object<O>& lhs, const Literal<L>& rhs)
215 template <
typename L,
typename O>
217 mln_trait_op_div(O, O)
218 operator/(const Literal<L>& lhs, const Object<O>& rhs)
226 template <
typename O,
typename L>
228 mln_trait_op_mod(O, O)
229 operator%(const Object<O>& lhs, const Literal<L>& rhs)
235 template <
typename L,
typename O>
237 mln_trait_op_mod(O, O)
238 operator%(const Literal<L>& lhs, const Object<O>& rhs)
247 template <
typename O,
typename L>
250 operator==(const Object<O>& lhs, const Literal<L>& rhs)
256 template <
typename L,
typename O>
259 operator==(const Literal<L>& lhs, const Object<O>& rhs)
265 template <
typename L1,
typename L2>
268 operator==(
const Literal<L1>&,
const Literal<L2>&)
270 return mlc_equal(L1, L2)::
value;
275 # endif // ! MLN_INCLUDE_ONLY
280 #endif // ! MLN_LITERAL_OPS_HH