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