File indexing completed on 2025-01-18 09:28:19
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_ACCUMULATORS_STATISTICS_COUNT_HPP_EAN_28_10_2005
0009 #define BOOST_ACCUMULATORS_STATISTICS_COUNT_HPP_EAN_28_10_2005
0010
0011 #include <boost/mpl/always.hpp>
0012 #include <boost/accumulators/framework/accumulator_base.hpp>
0013 #include <boost/accumulators/framework/extractor.hpp>
0014 #include <boost/accumulators/framework/depends_on.hpp>
0015 #include <boost/accumulators/statistics_fwd.hpp>
0016
0017 namespace boost { namespace accumulators
0018 {
0019
0020 namespace impl
0021 {
0022
0023
0024
0025 struct count_impl
0026 : accumulator_base
0027 {
0028
0029 typedef std::size_t result_type;
0030
0031 count_impl(dont_care)
0032 : cnt(0)
0033 {
0034 }
0035
0036 void operator ()(dont_care)
0037 {
0038 ++this->cnt;
0039 }
0040
0041 result_type result(dont_care) const
0042 {
0043 return this->cnt;
0044 }
0045
0046
0047 template<class Archive>
0048 void serialize(Archive & ar, const unsigned int )
0049 {
0050 ar & cnt;
0051 }
0052
0053 private:
0054 std::size_t cnt;
0055 };
0056
0057 }
0058
0059
0060
0061
0062 namespace tag
0063 {
0064 struct count
0065 : depends_on<>
0066 {
0067
0068
0069 typedef mpl::always<accumulators::impl::count_impl> impl;
0070 };
0071 }
0072
0073
0074
0075
0076 namespace extract
0077 {
0078 extractor<tag::count> const count = {};
0079
0080 BOOST_ACCUMULATORS_IGNORE_GLOBAL(count)
0081 }
0082
0083 using extract::count;
0084
0085 }}
0086
0087 #endif