11 #ifndef __EMA_MODULE_HEADER
12 #define __EMA_MODULE_HEADER
21 #include "../../util/mean_trait.hpp"
26 struct requirement<tag::ema<N> > {
31 template<
typename T,
typename _base,
int N>
32 class module<T, tag::ema<N>, _base>:
public _base {
42 sum_ = ((N-1) * (sum_)) / N + in;
46 return ema_impl<mean_type, T>();
54 template<
typename M,
typename U>
58 template<
typename M,
typename U>
59 typename enable_if<not is_same<M, U>::value, M>::type ema_impl()
const {
60 return round(sum_ / N);
67 #endif //__EMA_MODULE_HEADER
S & operator<<(S &os, oss_class< D, max_buf > const &arg)
Definition: serializer.hpp:158
void clear()
Definition: ema_module.hpp:48
T ema() const
Definition: ema_module.hpp:45
Definition: type_traits.hpp:228
module()
Definition: ema_module.hpp:37
Definition: module.hpp:33
ustd::conditional< detail::use_double_identifier< T >::value, double, T >::type type
Definition: mean_trait.hpp:44
void operator<<(T const &in)
Definition: ema_module.hpp:40
Definition: meta_list.hpp:22