fix doc example typo
[boost.git] / boost / accumulators / statistics / count.hpp
blob3bffd5638b79ba456f7e93fabbc25b997d60426b
1 ///////////////////////////////////////////////////////////////////////////////
2 // count.hpp
3 //
4 // Copyright 2005 Eric Niebler. Distributed under the Boost
5 // Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_ACCUMULATORS_STATISTICS_COUNT_HPP_EAN_28_10_2005
9 #define BOOST_ACCUMULATORS_STATISTICS_COUNT_HPP_EAN_28_10_2005
11 #include <boost/mpl/always.hpp>
12 #include <boost/accumulators/framework/accumulator_base.hpp>
13 #include <boost/accumulators/framework/extractor.hpp>
14 #include <boost/accumulators/framework/depends_on.hpp>
15 #include <boost/accumulators/statistics_fwd.hpp>
17 namespace boost { namespace accumulators
20 namespace impl
23 ///////////////////////////////////////////////////////////////////////////////
24 // count_impl
25 struct count_impl
26 : accumulator_base
28 // for boost::result_of
29 typedef std::size_t result_type;
31 count_impl(dont_care)
32 : cnt(0)
36 void operator ()(dont_care)
38 ++this->cnt;
41 result_type result(dont_care) const
43 return this->cnt;
46 private:
47 std::size_t cnt;
50 } // namespace impl
52 ///////////////////////////////////////////////////////////////////////////////
53 // tag::count
55 namespace tag
57 struct count
58 : depends_on<>
60 /// INTERNAL ONLY
61 ///
62 typedef mpl::always<accumulators::impl::count_impl> impl;
66 ///////////////////////////////////////////////////////////////////////////////
67 // extract::count
69 namespace extract
71 extractor<tag::count> const count = {};
74 using extract::count;
76 }} // namespace boost::accumulators
78 #endif