1 #ifndef PIXLED_FUNCTIONNAL_ARITHMETIC_H
2 #define PIXLED_FUNCTIONNAL_ARITHMETIC_H
4 #include "../function.h"
19 template<
typename R,
typename P1,
typename P2>
26 return this->
template call<0>(l, t) + this->
template call<1>(l, t);
45 template<
typename Arg1,
typename Arg2,
46 typename std::enable_if<
52 typename std::common_type<
53 typename std::remove_reference<Arg1>::type::Type,
54 typename std::remove_reference<Arg2>::type::Type
57 typename std::remove_reference<Arg1>::type::Type,
59 typename std::remove_reference<Arg2>::type::Type
61 return {std::forward<Arg1>(f1), std::forward<Arg2>(f2)};
78 template<
typename Arg1,
typename Arg2,
79 typename std::enable_if<
85 typename std::common_type<
86 typename std::remove_reference<Arg1>::type,
87 typename std::remove_reference<Arg2>::type::Type
90 typename std::remove_reference<Arg1>::type,
92 typename std::remove_reference<Arg2>::type::Type>
operator+(Arg1&& c1, Arg2&& f2) {
93 return {c1, std::forward<Arg2>(f2)};
111 template<
typename Arg1,
typename Arg2,
112 typename std::enable_if<
118 typename std::common_type<
119 typename std::remove_reference<Arg1>::type::Type,
120 typename std::remove_reference<Arg2>::type
123 typename std::remove_reference<Arg1>::type::Type,
125 typename std::remove_reference<Arg2>::type>
operator+(Arg1&& f1, Arg2&& c2) {
126 return {std::forward<Arg1>(f1), c2};
129 namespace arithmetic {
141 template<
typename R,
typename P1,
typename P2>
148 return this->
template call<0>(l, t) - this->
template call<1>(l, t);
167 template<
typename Arg1,
typename Arg2,
168 typename std::enable_if<
174 typename std::common_type<
175 typename std::remove_reference<Arg1>::type::Type,
176 typename std::remove_reference<Arg2>::type::Type
179 typename std::remove_reference<Arg1>::type::Type,
181 typename std::remove_reference<Arg2>::type::Type
183 return {std::forward<Arg1>(f1), std::forward<Arg2>(f2)};
201 template<
typename Arg1,
typename Arg2,
202 typename std::enable_if<
208 typename std::common_type<
209 typename std::remove_reference<Arg1>::type,
210 typename std::remove_reference<Arg2>::type::Type
213 typename std::remove_reference<Arg1>::type,
215 typename std::remove_reference<Arg2>::type::Type>
operator-(Arg1&& c1, Arg2&& f2) {
216 return {c1, std::forward<Arg2>(f2)};
234 template<
typename Arg1,
typename Arg2,
235 typename std::enable_if<
241 typename std::common_type<
242 typename std::remove_reference<Arg1>::type::Type,
243 typename std::remove_reference<Arg2>::type
246 typename std::remove_reference<Arg1>::type::Type,
248 typename std::remove_reference<Arg2>::type>
operator-(Arg1&& f1, Arg2&& c2) {
249 return {std::forward<Arg1>(f1), c2};
252 namespace arithmetic {
264 template<
typename R,
typename P1,
typename P2>
270 return this->
template call<0>(l, t) * this->
template call<1>(l, t);
289 template<
typename Arg1,
typename Arg2,
290 typename std::enable_if<
294 arithmetic::Multiplies<
296 typename std::common_type<
297 typename std::remove_reference<Arg1>::type::Type,
298 typename std::remove_reference<Arg2>::type::Type
301 typename std::remove_reference<Arg1>::type::Type,
303 typename std::remove_reference<Arg2>::type::Type
305 return {std::forward<Arg1>(f1), std::forward<Arg2>(f2)};
322 template<
typename Arg1,
typename Arg2,
323 typename std::enable_if<
327 arithmetic::Multiplies<
329 typename std::common_type<
330 typename std::remove_reference<Arg1>::type,
331 typename std::remove_reference<Arg2>::type::Type
334 typename std::remove_reference<Arg1>::type,
336 typename std::remove_reference<Arg2>::type::Type
338 return {c1, std::forward<Arg2>(f2)};
356 template<
typename Arg1,
typename Arg2,
357 typename std::enable_if<
361 arithmetic::Multiplies<
363 typename std::common_type<
364 typename std::remove_reference<Arg1>::type::Type,
365 typename std::remove_reference<Arg2>::type
368 typename std::remove_reference<Arg1>::type::Type,
370 typename std::remove_reference<Arg2>::type>
operator*(Arg1&& f1, Arg2&& c2) {
371 return {std::forward<Arg1>(f1), c2};
374 namespace arithmetic {
390 template<
typename R,
typename P1,
typename P2>
396 return this->
template call<0>(l, t) / this->
template call<1>(l, t);
415 template<
typename Arg1,
typename Arg2,
416 typename std::enable_if<
422 typename std::common_type<
423 typename std::remove_reference<Arg1>::type::Type,
424 typename std::remove_reference<Arg2>::type::Type
427 typename std::remove_reference<Arg1>::type::Type,
429 typename std::remove_reference<Arg2>::type::Type
431 return {std::forward<Arg1>(f1), std::forward<Arg2>(f2)};
448 template<
typename Arg1,
typename Arg2,
449 typename std::enable_if<
455 typename std::common_type<
456 typename std::remove_reference<Arg1>::type,
457 typename std::remove_reference<Arg2>::type::Type
460 typename std::remove_reference<Arg1>::type,
462 typename std::remove_reference<Arg2>::type::Type
464 return {c1, std::forward<Arg2>(f2)};
481 template<
typename Arg1,
typename Arg2,
482 typename std::enable_if<
488 typename std::common_type<
489 typename std::remove_reference<Arg1>::type::Type,
490 typename std::remove_reference<Arg2>::type
493 typename std::remove_reference<Arg1>::type::Type,
495 typename std::remove_reference<Arg2>::type
497 return {std::forward<Arg1>(f1), c2};
500 namespace arithmetic {
512 template<
typename R,
typename P1,
typename P2>
518 return this->
template call<0>(l, t) % this->
template call<1>(l, t);
537 template<
typename Arg1,
typename Arg2,
538 typename std::enable_if<
544 typename std::common_type<
545 typename std::remove_reference<Arg1>::type::Type,
546 typename std::remove_reference<Arg2>::type::Type
549 typename std::remove_reference<Arg1>::type::Type,
551 typename std::remove_reference<Arg2>::type::Type
553 return {std::forward<Arg1>(f1), std::forward<Arg2>(f2)};
570 template<
typename Arg1,
typename Arg2,
571 typename std::enable_if<
577 typename std::common_type<
578 typename std::remove_reference<Arg1>::type,
579 typename std::remove_reference<Arg2>::type::Type
582 typename std::remove_reference<Arg1>::type,
584 typename std::remove_reference<Arg2>::type::Type
586 return {c1, std::forward<Arg2>(f2)};
603 template<
typename Arg1,
typename Arg2,
604 typename std::enable_if<
610 typename std::common_type<
611 typename std::remove_reference<Arg1>::type::Type,
612 typename std::remove_reference<Arg2>::type
615 typename std::remove_reference<Arg1>::type::Type,
617 typename std::remove_reference<Arg2>::type
619 return {std::forward<Arg1>(f1), c2};
Definition: function.h:349
Function(Fcts &&... fcts)
Definition: function.h:383
Definition: arithmetic.h:391
R operator()(led l, time t) const override
Definition: arithmetic.h:395
Definition: arithmetic.h:142
R operator()(led l, time t) const override
Definition: arithmetic.h:147
Definition: arithmetic.h:513
R operator()(led l, time t) const override
Definition: arithmetic.h:517
Definition: arithmetic.h:265
R operator()(led l, time t) const override
Definition: arithmetic.h:269
Definition: arithmetic.h:20
R operator()(led l, time t) const override
Definition: arithmetic.h:25
Definition: animation.cpp:3
arithmetic::Minus< typename std::common_type< typename std::remove_reference< Arg1 >::type::Type, typename std::remove_reference< Arg2 >::type::Type >::type, typename std::remove_reference< Arg1 >::type::Type, typename std::remove_reference< Arg2 >::type::Type > operator-(Arg1 &&f1, Arg2 &&f2)
Definition: arithmetic.h:182
arithmetic::Multiplies< typename std::common_type< typename std::remove_reference< Arg1 >::type::Type, typename std::remove_reference< Arg2 >::type::Type >::type, typename std::remove_reference< Arg1 >::type::Type, typename std::remove_reference< Arg2 >::type::Type > operator*(Arg1 &&f1, Arg2 &&f2)
Definition: arithmetic.h:304
arithmetic::Modulus< typename std::common_type< typename std::remove_reference< Arg1 >::type::Type, typename std::remove_reference< Arg2 >::type::Type >::type, typename std::remove_reference< Arg1 >::type::Type, typename std::remove_reference< Arg2 >::type::Type > operator%(Arg1 &&f1, Arg2 &&f2)
Definition: arithmetic.h:552
arithmetic::Plus< typename std::common_type< typename std::remove_reference< Arg1 >::type::Type, typename std::remove_reference< Arg2 >::type::Type >::type, typename std::remove_reference< Arg1 >::type::Type, typename std::remove_reference< Arg2 >::type::Type > operator+(Arg1 &&f1, Arg2 &&f2)
Definition: arithmetic.h:60
unsigned long time
Definition: time.h:10
arithmetic::Divides< typename std::common_type< typename std::remove_reference< Arg1 >::type::Type, typename std::remove_reference< Arg2 >::type::Type >::type, typename std::remove_reference< Arg1 >::type::Type, typename std::remove_reference< Arg2 >::type::Type > operator/(Arg1 &&f1, Arg2 &&f2)
Definition: arithmetic.h:430
static constexpr bool value
Definition: function.h:82