]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/accumulators/include/boost/accumulators/statistics/max.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / accumulators / include / boost / accumulators / statistics / max.hpp
CommitLineData
7c673cae
FG
1///////////////////////////////////////////////////////////////////////////////
2// max.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)
7
8#ifndef BOOST_ACCUMULATORS_STATISTICS_MAX_HPP_EAN_28_10_2005
9#define BOOST_ACCUMULATORS_STATISTICS_MAX_HPP_EAN_28_10_2005
10
11#include <limits>
12#include <boost/mpl/placeholders.hpp>
13#include <boost/accumulators/framework/accumulator_base.hpp>
14#include <boost/accumulators/framework/extractor.hpp>
15#include <boost/accumulators/framework/parameters/sample.hpp>
16#include <boost/accumulators/numeric/functional.hpp>
17#include <boost/accumulators/framework/depends_on.hpp>
18#include <boost/accumulators/statistics_fwd.hpp>
19
20namespace boost { namespace accumulators
21{
22
23namespace impl
24{
25 ///////////////////////////////////////////////////////////////////////////////
26 // max_impl
27 template<typename Sample>
28 struct max_impl
29 : accumulator_base
30 {
31 // for boost::result_of
32 typedef Sample result_type;
33
34 template<typename Args>
35 max_impl(Args const &args)
36 : max_(numeric::as_min(args[sample | Sample()]))
37 {
38 }
39
40 template<typename Args>
41 void operator ()(Args const &args)
42 {
43 numeric::max_assign(this->max_, args[sample]);
44 }
45
46 result_type result(dont_care) const
47 {
48 return this->max_;
49 }
50
51 private:
52 Sample max_;
53 };
54
55} // namespace impl
56
57///////////////////////////////////////////////////////////////////////////////
58// tag::max
59//
60namespace tag
61{
62 struct max
63 : depends_on<>
64 {
65 /// INTERNAL ONLY
66 ///
67 typedef accumulators::impl::max_impl<mpl::_1> impl;
68 };
69}
70
71///////////////////////////////////////////////////////////////////////////////
72// extract::max
73//
74namespace extract
75{
76 extractor<tag::max> const max = {};
77
78 BOOST_ACCUMULATORS_IGNORE_GLOBAL(max)
79}
80
81using extract::max;
82
83}} // namespace boost::accumulators
84
85#endif