26 #ifndef MLN_ACCU_MATH_COUNT_HH
27 # define MLN_ACCU_MATH_COUNT_HH
35 # include <mln/accu/internal/base.hh>
36 # include <mln/core/concept/meta_accumulator.hh>
45 template <
typename T>
struct count;
56 struct accumulator_< accu::math::count<T> >
58 typedef accumulator::has_untake::yes has_untake;
59 typedef accumulator::has_set_value::yes has_set_value;
60 typedef accumulator::has_stop::no has_stop;
61 typedef accumulator::when_pix::use_none when_pix;
100 struct count :
public mln::accu::internal::base< unsigned , count<T> >
109 void take(
const argument&);
112 void untake(
const argument&);
133 # ifndef MLN_INCLUDE_ONLY
135 template <
typename T>
142 template <
typename T>
150 template <
typename T>
158 template <
typename T>
161 count<T>::untake(
const argument&)
163 mln_precondition(count_ > 0);
167 template <
typename T>
170 count<T>::take(
const count<T>& other)
172 count_ += other.count_;
175 template <
typename T>
178 count<T>::untake(
const count<T>& other)
180 mln_precondition(other.count_ <= count_);
181 count_ -= other.count_;
184 template <
typename T>
192 template <
typename T>
200 template <
typename T>
208 # endif // ! MLN_INCLUDE_ONLY
217 #endif // ! MLN_ACCU_MATH_COUNT_HH