]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/accumulators/include/boost/accumulators/accumulators_fwd.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / accumulators / include / boost / accumulators / accumulators_fwd.hpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // accumulators_fwd.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_ACCUMULATORS_FWD_HPP_EAN_28_10_2005
9 #define BOOST_ACCUMULATORS_ACCUMULATORS_FWD_HPP_EAN_28_10_2005
10
11 #include <boost/config.hpp>
12 #include <boost/mpl/apply_fwd.hpp> // for mpl::na
13 #include <boost/mpl/limits/vector.hpp>
14 #include <boost/preprocessor/cat.hpp>
15 #include <boost/preprocessor/arithmetic/inc.hpp>
16 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
17 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
18 #include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
19 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
20 #include <boost/accumulators/numeric/functional_fwd.hpp>
21
22 #ifndef BOOST_ACCUMULATORS_MAX_FEATURES
23 /// The maximum number of accumulators that may be put in an accumulator_set.
24 /// Defaults to BOOST_MPL_LIMIT_VECTOR_SIZE (which defaults to 20).
25 # define BOOST_ACCUMULATORS_MAX_FEATURES BOOST_MPL_LIMIT_VECTOR_SIZE
26 #endif
27
28 #if BOOST_ACCUMULATORS_MAX_FEATURES > BOOST_MPL_LIMIT_VECTOR_SIZE
29 # error BOOST_ACCUMULATORS_MAX_FEATURES cannot be larger than BOOST_MPL_LIMIT_VECTOR_SIZE
30 #endif
31
32 #ifndef BOOST_ACCUMULATORS_MAX_ARGS
33 /// The maximum number of arguments that may be specified to an accumulator_set's
34 /// accumulation function. Defaults to 15.
35 # define BOOST_ACCUMULATORS_MAX_ARGS 15
36 #endif
37
38 #if BOOST_WORKAROUND(__GNUC__, == 3) \
39 || BOOST_WORKAROUND(__EDG_VERSION__, BOOST_TESTED_AT(306))
40 # define BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS
41 #endif
42
43 #ifdef BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS
44 # include <boost/utility/enable_if.hpp>
45 # include <boost/type_traits/is_const.hpp>
46 # define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)\
47 , typename boost::disable_if<boost::is_const<T> >::type * = 0
48 #else
49 # define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)
50 #endif
51
52 #define BOOST_ACCUMULATORS_GCC_VERSION \
53 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
54
55 namespace boost { namespace accumulators
56 {
57
58 ///////////////////////////////////////////////////////////////////////////////
59 // Named parameters tags
60 //
61 namespace tag
62 {
63 struct sample;
64 struct weight;
65 struct accumulator;
66 struct weights;
67 }
68
69 ///////////////////////////////////////////////////////////////////////////////
70 // User-level features
71 //
72 namespace tag
73 {
74 template<typename ValueType, typename Tag>
75 struct value;
76
77 template<typename Tag>
78 struct value_tag;
79
80 template<typename Referent, typename Tag>
81 struct reference;
82
83 template<typename Tag>
84 struct reference_tag;
85
86 template<typename Type, typename Tag = void, typename AccumulatorSet = void>
87 struct external;
88
89 template<typename Feature>
90 struct droppable;
91 }
92
93 template<typename Accumulator>
94 struct droppable_accumulator_base;
95
96 template<typename Accumulator>
97 struct droppable_accumulator;
98
99 template<typename Accumulator>
100 struct with_cached_result;
101
102 template<typename Sample, typename Features, typename Weight = void>
103 struct accumulator_set;
104
105 template<typename Feature>
106 struct extractor;
107
108 template<typename Feature>
109 struct feature_of;
110
111 template<typename Feature>
112 struct as_feature;
113
114 template<typename Feature>
115 struct as_weighted_feature;
116
117 template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature, mpl::na)>
118 struct depends_on;
119
120 template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature, mpl::na)>
121 struct features;
122
123 template<typename Feature, typename AccumulatorSet>
124 typename mpl::apply<AccumulatorSet, Feature>::type const &
125 find_accumulator(AccumulatorSet const &acc);
126
127 template<typename Feature, typename AccumulatorSet>
128 typename mpl::apply<AccumulatorSet, Feature>::type::result_type
129 extract_result(AccumulatorSet const &acc);
130
131 template<typename Feature, typename AccumulatorSet, typename A1>
132 typename mpl::apply<AccumulatorSet, Feature>::type::result_type
133 extract_result(AccumulatorSet const &acc, A1 const &a1);
134
135 // ... other overloads generated by Boost.Preprocessor:
136
137 /// INTERNAL ONLY
138 ///
139 #define BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD(z, n, _) \
140 template< \
141 typename Feature \
142 , typename AccumulatorSet \
143 BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \
144 > \
145 typename mpl::apply<AccumulatorSet, Feature>::type::result_type \
146 extract_result( \
147 AccumulatorSet const &acc \
148 BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \
149 );
150
151 /// INTERNAL ONLY
152 ///
153 BOOST_PP_REPEAT_FROM_TO(
154 2
155 , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS)
156 , BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD
157 , _
158 )
159
160 #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
161 template<typename Feature, typename AccumulatorSet, typename A1, typename A2 ...>
162 typename mpl::apply<AccumulatorSet, Feature>::type::result_type
163 extract_result(AccumulatorSet const &acc, A1 const &a1, A2 const &a2 ...);
164 #endif
165
166 namespace impl
167 {
168 using namespace numeric::operators;
169
170 template<typename Accumulator, typename Tag>
171 struct external_impl;
172 }
173
174 namespace detail
175 {
176 template<typename Accumulator>
177 struct feature_tag;
178
179 template<typename Feature, typename Sample, typename Weight>
180 struct to_accumulator;
181
182 struct accumulator_set_base;
183
184 template<typename T>
185 struct is_accumulator_set;
186
187 inline void ignore_variable(void const *) {}
188
189 #define BOOST_ACCUMULATORS_IGNORE_GLOBAL(X) \
190 namespace detail \
191 { \
192 struct BOOST_PP_CAT(ignore_, X) \
193 { \
194 void ignore() \
195 { \
196 boost::accumulators::detail::ignore_variable(&X); \
197 } \
198 }; \
199 } \
200 /**/
201 }
202
203 }} // namespace boost::accumulators
204
205 // For defining boost::parameter keywords that can be inherited from to
206 // get a nested, class-scoped keyword with the requested alias
207 #define BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias) \
208 namespace tag_namespace \
209 { \
210 template<int Dummy = 0> \
211 struct name ## _ \
212 { \
213 static char const* keyword_name() \
214 { \
215 return #name; \
216 } \
217 static ::boost::parameter::keyword<name ## _<Dummy> > &alias; \
218 }; \
219 template<int Dummy> \
220 ::boost::parameter::keyword<name ## _<Dummy> > &name ## _<Dummy>::alias = \
221 ::boost::parameter::keyword<name ## _<Dummy> >::get(); \
222 typedef name ## _ <> name; \
223 } \
224 namespace \
225 { \
226 ::boost::parameter::keyword<tag_namespace::name> &name = \
227 ::boost::parameter::keyword<tag_namespace::name>::get(); \
228 }
229
230 #endif