Changeset View
Changeset View
Standalone View
Standalone View
devel/boost-libs/files/patch-accumulators23
- This file was added.
https://github.com/boostorg/accumulators/pull/23 | |||||
--- boost/accumulators/accumulators_fwd.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/accumulators_fwd.hpp | |||||
@@ -9,6 +9,8 @@ | |||||
#define BOOST_ACCUMULATORS_ACCUMULATORS_FWD_HPP_EAN_28_10_2005 | |||||
#include <boost/config.hpp> | |||||
+#include <boost/core/enable_if.hpp> | |||||
+#include <boost/parameter/is_argument_pack.hpp> | |||||
#include <boost/mpl/apply_fwd.hpp> // for mpl::na | |||||
#include <boost/mpl/limits/vector.hpp> | |||||
#include <boost/preprocessor/cat.hpp> | |||||
@@ -41,7 +43,6 @@ | |||||
#endif | |||||
#ifdef BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS | |||||
-# include <boost/utility/enable_if.hpp> | |||||
# include <boost/type_traits/is_const.hpp> | |||||
# define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)\ | |||||
, typename boost::disable_if<boost::is_const<T> >::type * = 0 | |||||
@@ -128,9 +129,12 @@ template<typename Feature, typename AccumulatorSet> | |||||
typename mpl::apply<AccumulatorSet, Feature>::type::result_type | |||||
extract_result(AccumulatorSet const &acc); | |||||
-template<typename Feature, typename AccumulatorSet, typename A1> | |||||
-typename mpl::apply<AccumulatorSet, Feature>::type::result_type | |||||
-extract_result(AccumulatorSet const &acc, A1 const &a1); | |||||
+namespace detail | |||||
+{ | |||||
+ struct _enabler | |||||
+ { | |||||
+ }; | |||||
+} | |||||
// ... other overloads generated by Boost.Preprocessor: | |||||
@@ -146,17 +150,37 @@ extract_result(AccumulatorSet const &acc, A1 const &a1 | |||||
extract_result( \ | |||||
AccumulatorSet const &acc \ | |||||
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \ | |||||
+ , typename boost::enable_if< \ | |||||
+ parameter::is_argument_pack<A0> \ | |||||
+ , detail::_enabler \ | |||||
+ >::type = detail::_enabler() \ | |||||
+ ); \ | |||||
+ template< \ | |||||
+ typename Feature \ | |||||
+ , typename AccumulatorSet \ | |||||
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \ | |||||
+ > \ | |||||
+ typename mpl::apply<AccumulatorSet, Feature>::type::result_type \ | |||||
+ extract_result( \ | |||||
+ AccumulatorSet const &acc \ | |||||
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \ | |||||
+ , typename boost::disable_if< \ | |||||
+ parameter::is_argument_pack<A0> \ | |||||
+ , detail::_enabler \ | |||||
+ >::type = detail::_enabler() \ | |||||
); | |||||
/// INTERNAL ONLY | |||||
/// | |||||
BOOST_PP_REPEAT_FROM_TO( | |||||
- 2 | |||||
+ 1 | |||||
, BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) | |||||
, BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD | |||||
, _ | |||||
) | |||||
+#undef BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD | |||||
+ | |||||
#ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED | |||||
template<typename Feature, typename AccumulatorSet, typename A1, typename A2 ...> | |||||
typename mpl::apply<AccumulatorSet, Feature>::type::result_type | |||||
@@ -185,7 +209,10 @@ namespace detail | |||||
struct is_accumulator_set; | |||||
inline void ignore_variable(void const *) {} | |||||
+} | |||||
+}} // namespace boost::accumulators | |||||
+ | |||||
#define BOOST_ACCUMULATORS_IGNORE_GLOBAL(X) \ | |||||
namespace detail \ | |||||
{ \ | |||||
@@ -198,33 +225,8 @@ namespace detail | |||||
}; \ | |||||
} \ | |||||
/**/ | |||||
-} | |||||
-}} // namespace boost::accumulators | |||||
+#include <boost/parameter/nested_keyword.hpp> | |||||
-// For defining boost::parameter keywords that can be inherited from to | |||||
-// get a nested, class-scoped keyword with the requested alias | |||||
-#define BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias) \ | |||||
- namespace tag_namespace \ | |||||
- { \ | |||||
- template<int Dummy = 0> \ | |||||
- struct name ## _ \ | |||||
- { \ | |||||
- static char const* keyword_name() \ | |||||
- { \ | |||||
- return #name; \ | |||||
- } \ | |||||
- static ::boost::parameter::keyword<name ## _<Dummy> > &alias; \ | |||||
- }; \ | |||||
- template<int Dummy> \ | |||||
- ::boost::parameter::keyword<name ## _<Dummy> > &name ## _<Dummy>::alias = \ | |||||
- ::boost::parameter::keyword<name ## _<Dummy> >::get(); \ | |||||
- typedef name ## _ <> name; \ | |||||
- } \ | |||||
- namespace \ | |||||
- { \ | |||||
- ::boost::parameter::keyword<tag_namespace::name> &name = \ | |||||
- ::boost::parameter::keyword<tag_namespace::name>::get(); \ | |||||
- } | |||||
+#endif // include guard | |||||
-#endif | |||||
--- boost/accumulators/framework/accumulator_set.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/framework/accumulator_set.hpp | |||||
@@ -9,16 +9,23 @@ | |||||
#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_SET_HPP_EAN_28_10_2005 | |||||
#include <boost/version.hpp> | |||||
+#include <boost/mpl/bool.hpp> | |||||
+#include <boost/mpl/if.hpp> | |||||
#include <boost/mpl/apply.hpp> | |||||
#include <boost/mpl/assert.hpp> | |||||
#include <boost/mpl/protect.hpp> | |||||
#include <boost/mpl/identity.hpp> | |||||
#include <boost/mpl/is_sequence.hpp> | |||||
#include <boost/type_traits/is_same.hpp> | |||||
-#include <boost/type_traits/is_base_and_derived.hpp> | |||||
-#include <boost/parameter/parameters.hpp> | |||||
+#include <boost/type_traits/is_base_of.hpp> | |||||
+#include <boost/type_traits/remove_const.hpp> | |||||
+#include <boost/type_traits/remove_reference.hpp> | |||||
+#include <boost/core/enable_if.hpp> | |||||
+#include <boost/parameter/is_argument_pack.hpp> | |||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp> | |||||
+#include <boost/preprocessor/repetition/enum_params.hpp> | |||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp> | |||||
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp> | |||||
#include <boost/accumulators/accumulators_fwd.hpp> | |||||
#include <boost/accumulators/framework/depends_on.hpp> | |||||
#include <boost/accumulators/framework/accumulator_concept.hpp> | |||||
@@ -64,14 +71,6 @@ namespace detail | |||||
return accumulator_visitor<Args>(args); | |||||
} | |||||
- typedef | |||||
- parameter::parameters< | |||||
- parameter::required<tag::accumulator> | |||||
- , parameter::optional<tag::sample> | |||||
- // ... and others which are not specified here... | |||||
- > | |||||
- accumulator_params; | |||||
- | |||||
/////////////////////////////////////////////////////////////////////////////// | |||||
// accumulator_set_base | |||||
struct accumulator_set_base | |||||
@@ -82,7 +81,16 @@ namespace detail | |||||
// is_accumulator_set | |||||
template<typename T> | |||||
struct is_accumulator_set | |||||
- : is_base_and_derived<accumulator_set_base, T> | |||||
+ : mpl::if_< | |||||
+ boost::is_base_of< | |||||
+ accumulator_set_base | |||||
+ , typename boost::remove_const< | |||||
+ typename boost::remove_reference<T>::type | |||||
+ >::type | |||||
+ > | |||||
+ , mpl::true_ | |||||
+ , mpl::false_ | |||||
+ >::type | |||||
{ | |||||
}; | |||||
@@ -140,13 +148,13 @@ struct accumulator_set | |||||
: accumulators( | |||||
detail::make_acc_list( | |||||
accumulators_mpl_vector() | |||||
- , detail::accumulator_params()(*this) | |||||
+ , (boost::accumulators::accumulator = *this) | |||||
) | |||||
) | |||||
{ | |||||
// Add-ref the Features that the user has specified | |||||
this->template visit_if<detail::contains_feature_of_<Features> >( | |||||
- detail::make_add_ref_visitor(detail::accumulator_params()(*this)) | |||||
+ detail::make_add_ref_visitor(boost::accumulators::accumulator = *this) | |||||
); | |||||
} | |||||
@@ -154,40 +162,99 @@ struct accumulator_set | |||||
/// | |||||
/// \param a1 Optional named parameter to be passed to all the accumulators | |||||
template<typename A1> | |||||
- explicit accumulator_set(A1 const &a1) | |||||
- : accumulators( | |||||
+ explicit accumulator_set( | |||||
+ A1 const &a1 | |||||
+ , typename boost::enable_if< | |||||
+ parameter::is_argument_pack<A1> | |||||
+ , detail::_enabler | |||||
+ >::type = detail::_enabler() | |||||
+ ) : accumulators( | |||||
detail::make_acc_list( | |||||
accumulators_mpl_vector() | |||||
- , detail::accumulator_params()(*this, a1) | |||||
+ , (boost::accumulators::accumulator = *this, a1) | |||||
) | |||||
) | |||||
{ | |||||
// Add-ref the Features that the user has specified | |||||
this->template visit_if<detail::contains_feature_of_<Features> >( | |||||
- detail::make_add_ref_visitor(detail::accumulator_params()(*this)) | |||||
+ detail::make_add_ref_visitor(boost::accumulators::accumulator = *this) | |||||
); | |||||
} | |||||
+ /// \overload | |||||
+ /// | |||||
+ /// \param a1 Optional sample parameter to be passed to all the accumulators | |||||
+ template<typename A1> | |||||
+ explicit accumulator_set( | |||||
+ A1 const &a1 | |||||
+ , typename boost::disable_if< | |||||
+ parameter::is_argument_pack<A1> | |||||
+ , detail::_enabler | |||||
+ >::type = detail::_enabler() | |||||
+ ) : accumulators( | |||||
+ detail::make_acc_list( | |||||
+ accumulators_mpl_vector() | |||||
+ , ( | |||||
+ boost::accumulators::accumulator = *this | |||||
+ , boost::accumulators::sample = a1 | |||||
+ ) | |||||
+ ) | |||||
+ ) | |||||
+ { | |||||
+ // Add-ref the Features that the user has specified | |||||
+ this->template visit_if<detail::contains_feature_of_<Features> >( | |||||
+ detail::make_add_ref_visitor(boost::accumulators::accumulator = *this) | |||||
+ ); | |||||
+ } | |||||
+ | |||||
// ... other overloads generated by Boost.Preprocessor: | |||||
/// INTERNAL ONLY | |||||
/// | |||||
#define BOOST_ACCUMULATORS_ACCUMULATOR_SET_CTOR(z, n, _) \ | |||||
template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ | |||||
- accumulator_set(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a)) \ | |||||
- : accumulators( \ | |||||
+ accumulator_set( \ | |||||
+ BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a) \ | |||||
+ , typename boost::enable_if< \ | |||||
+ parameter::is_argument_pack<A0> \ | |||||
+ , detail::_enabler \ | |||||
+ >::type = detail::_enabler() \ | |||||
+ ) : accumulators( \ | |||||
detail::make_acc_list( \ | |||||
accumulators_mpl_vector() \ | |||||
- , detail::accumulator_params()( \ | |||||
- *this BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \ | |||||
+ , ( \ | |||||
+ boost::accumulators::accumulator = *this \ | |||||
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \ | |||||
) \ | |||||
) \ | |||||
) \ | |||||
{ \ | |||||
/* Add-ref the Features that the user has specified */ \ | |||||
this->template visit_if<detail::contains_feature_of_<Features> >( \ | |||||
- detail::make_add_ref_visitor(detail::accumulator_params()(*this)) \ | |||||
+ detail::make_add_ref_visitor(boost::accumulators::accumulator = *this) \ | |||||
); \ | |||||
+ } \ | |||||
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ | |||||
+ accumulator_set( \ | |||||
+ BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a) \ | |||||
+ , typename boost::disable_if< \ | |||||
+ parameter::is_argument_pack<A0> \ | |||||
+ , detail::_enabler \ | |||||
+ >::type = detail::_enabler() \ | |||||
+ ) : accumulators( \ | |||||
+ detail::make_acc_list( \ | |||||
+ accumulators_mpl_vector() \ | |||||
+ , ( \ | |||||
+ boost::accumulators::accumulator = *this \ | |||||
+ , boost::accumulators::sample = BOOST_PP_ENUM_PARAMS_Z(z, n, a) \ | |||||
+ ) \ | |||||
+ ) \ | |||||
+ ) \ | |||||
+ { \ | |||||
+ /* Add-ref the Features that the user has specified */ \ | |||||
+ this->template visit_if<detail::contains_feature_of_<Features> >( \ | |||||
+ detail::make_add_ref_visitor(boost::accumulators::accumulator = *this) \ | |||||
+ ); \ | |||||
} | |||||
/// INTERNAL ONLY | |||||
@@ -239,42 +306,57 @@ struct accumulator_set | |||||
{ | |||||
this->visit( | |||||
detail::make_accumulator_visitor( | |||||
- detail::accumulator_params()(*this) | |||||
+ boost::accumulators::accumulator = *this | |||||
) | |||||
); | |||||
} | |||||
- template<typename A1> | |||||
- void operator ()(A1 const &a1) | |||||
- { | |||||
- this->visit( | |||||
- detail::make_accumulator_visitor( | |||||
- detail::accumulator_params()(*this, a1) | |||||
- ) | |||||
- ); | |||||
- } | |||||
- | |||||
// ... other overloads generated by Boost.Preprocessor: | |||||
/// INTERNAL ONLY | |||||
/// | |||||
#define BOOST_ACCUMULATORS_ACCUMULATOR_SET_FUN_OP(z, n, _) \ | |||||
template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ | |||||
- void operator ()(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a)) \ | |||||
+ void operator ()( \ | |||||
+ BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a) \ | |||||
+ , typename boost::enable_if< \ | |||||
+ parameter::is_argument_pack<A0> \ | |||||
+ , detail::_enabler \ | |||||
+ >::type = detail::_enabler() \ | |||||
+ ) \ | |||||
{ \ | |||||
this->visit( \ | |||||
detail::make_accumulator_visitor( \ | |||||
- detail::accumulator_params()( \ | |||||
- *this BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \ | |||||
+ ( \ | |||||
+ boost::accumulators::accumulator = *this \ | |||||
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \ | |||||
) \ | |||||
) \ | |||||
); \ | |||||
+ } \ | |||||
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ | |||||
+ void operator ()( \ | |||||
+ BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a) \ | |||||
+ , typename boost::disable_if< \ | |||||
+ parameter::is_argument_pack<A0> \ | |||||
+ , detail::_enabler \ | |||||
+ >::type = detail::_enabler() \ | |||||
+ ) \ | |||||
+ { \ | |||||
+ this->visit( \ | |||||
+ detail::make_accumulator_visitor( \ | |||||
+ ( \ | |||||
+ boost::accumulators::accumulator = *this \ | |||||
+ , boost::accumulators::sample = BOOST_PP_ENUM_PARAMS_Z(z, n, a) \ | |||||
+ ) \ | |||||
+ ) \ | |||||
+ ); \ | |||||
} | |||||
/// INTERNAL ONLY | |||||
/// | |||||
BOOST_PP_REPEAT_FROM_TO( | |||||
- 2 | |||||
+ 1 | |||||
, BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) | |||||
, BOOST_ACCUMULATORS_ACCUMULATOR_SET_FUN_OP | |||||
, _ | |||||
@@ -329,12 +411,12 @@ struct accumulator_set | |||||
the_feature; | |||||
(*fusion::find_if<detail::matches_feature<Feature> >(this->accumulators)) | |||||
- .drop(detail::accumulator_params()(*this)); | |||||
+ .drop(boost::accumulators::accumulator = *this); | |||||
// Also drop accumulators that this feature depends on | |||||
typedef typename the_feature::dependencies dependencies; | |||||
this->template visit_if<detail::contains_feature_of_<dependencies> >( | |||||
- detail::make_drop_visitor(detail::accumulator_params()(*this)) | |||||
+ detail::make_drop_visitor(boost::accumulators::accumulator = *this) | |||||
); | |||||
} | |||||
@@ -365,6 +447,15 @@ find_accumulator(AccumulatorSet const &acc) | |||||
return acc.template extract<Feature>(); | |||||
} | |||||
+template<typename Feature, typename AccumulatorSet> | |||||
+typename mpl::apply<AccumulatorSet, Feature>::type::result_type | |||||
+extract_result(AccumulatorSet const &acc) | |||||
+{ | |||||
+ return find_accumulator<Feature>(acc).result( | |||||
+ boost::accumulators::accumulator = acc | |||||
+ ); | |||||
+} | |||||
+ | |||||
/////////////////////////////////////////////////////////////////////////////// | |||||
// extract_result | |||||
// extract a result from an accumulator set | |||||
@@ -380,18 +471,43 @@ find_accumulator(AccumulatorSet const &acc) | |||||
extract_result( \ | |||||
AccumulatorSet const &acc \ | |||||
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \ | |||||
+ , typename boost::enable_if< \ | |||||
+ parameter::is_argument_pack<A0> \ | |||||
+ , detail::_enabler \ | |||||
+ >::type \ | |||||
) \ | |||||
{ \ | |||||
return find_accumulator<Feature>(acc).result( \ | |||||
- detail::accumulator_params()( \ | |||||
- acc \ | |||||
+ ( \ | |||||
+ boost::accumulators::accumulator = acc \ | |||||
BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \ | |||||
) \ | |||||
); \ | |||||
+ } \ | |||||
+ template< \ | |||||
+ typename Feature \ | |||||
+ , typename AccumulatorSet \ | |||||
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \ | |||||
+ > \ | |||||
+ typename mpl::apply<AccumulatorSet, Feature>::type::result_type \ | |||||
+ extract_result( \ | |||||
+ AccumulatorSet const &acc \ | |||||
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \ | |||||
+ , typename boost::disable_if< \ | |||||
+ parameter::is_argument_pack<A0> \ | |||||
+ , detail::_enabler \ | |||||
+ >::type \ | |||||
+ ) \ | |||||
+ { \ | |||||
+ return find_accumulator<Feature>(acc).result(( \ | |||||
+ boost::accumulators::accumulator = acc \ | |||||
+ , boost::accumulators::sample = BOOST_PP_ENUM_PARAMS_Z(z, n, a) \ | |||||
+ )); \ | |||||
} | |||||
-BOOST_PP_REPEAT( | |||||
- BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) | |||||
+BOOST_PP_REPEAT_FROM_TO( | |||||
+ 1 | |||||
+ , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) | |||||
, BOOST_ACCUMULATORS_EXTRACT_RESULT_FUN | |||||
, _ | |||||
) | |||||
--- boost/accumulators/framework/accumulators/external_accumulator.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/framework/accumulators/external_accumulator.hpp | |||||
@@ -34,7 +34,7 @@ namespace boost { namespace accumulators { namespace i | |||||
template<typename Args> | |||||
result_type result(Args const &args) const | |||||
{ | |||||
- return this->extract_(args, args[parameter::keyword<Tag>::get() | 0]); | |||||
+ return this->extract_(args, args[parameter::keyword<Tag>::instance | 0]); | |||||
} | |||||
private: | |||||
--- boost/accumulators/framework/accumulators/reference_accumulator.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/framework/accumulators/reference_accumulator.hpp | |||||
@@ -31,7 +31,7 @@ namespace impl | |||||
template<typename Args> | |||||
reference_accumulator_impl(Args const &args) | |||||
- : ref(args[parameter::keyword<Tag>::get()]) | |||||
+ : ref(args[parameter::keyword<Tag>::instance]) | |||||
{ | |||||
} | |||||
--- boost/accumulators/framework/accumulators/value_accumulator.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/framework/accumulators/value_accumulator.hpp | |||||
@@ -30,7 +30,7 @@ namespace impl | |||||
template<typename Args> | |||||
value_accumulator_impl(Args const &args) | |||||
- : val(args[parameter::keyword<Tag>::get()]) | |||||
+ : val(args[parameter::keyword<Tag>::instance]) | |||||
{ | |||||
} | |||||
--- boost/accumulators/framework/depends_on.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/framework/depends_on.hpp | |||||
@@ -266,9 +266,16 @@ namespace boost { namespace accumulators | |||||
template<typename Sequence, typename Args> | |||||
typename meta::make_acc_list<Sequence>::type | |||||
- make_acc_list(Sequence const &seq, Args const &args) | |||||
+ make_acc_list(Sequence &seq, Args const &args) | |||||
{ | |||||
return meta::make_acc_list<Sequence>::call(args, fusion::begin(seq), fusion::end(seq)); | |||||
+ } | |||||
+ | |||||
+ template<typename Sequence, typename Args> | |||||
+ typename meta::make_acc_list<Sequence>::type | |||||
+ make_acc_list(Sequence const &seq, Args const &args) | |||||
+ { | |||||
+ return meta::make_acc_list<Sequence const>::call(args, fusion::begin(seq), fusion::end(seq)); | |||||
} | |||||
/////////////////////////////////////////////////////////////////////////// | |||||
--- boost/accumulators/framework/extractor.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/framework/extractor.hpp | |||||
@@ -8,6 +8,7 @@ | |||||
#ifndef BOOST_ACCUMULATORS_FRAMEWORK_EXTRACTOR_HPP_EAN_28_10_2005 | |||||
#define BOOST_ACCUMULATORS_FRAMEWORK_EXTRACTOR_HPP_EAN_28_10_2005 | |||||
+#include <boost/preprocessor/cat.hpp> | |||||
#include <boost/preprocessor/tuple/rem.hpp> | |||||
#include <boost/preprocessor/array/size.hpp> | |||||
#include <boost/preprocessor/array/data.hpp> | |||||
@@ -15,11 +16,17 @@ | |||||
#include <boost/preprocessor/seq/to_array.hpp> | |||||
#include <boost/preprocessor/seq/transform.hpp> | |||||
#include <boost/preprocessor/repetition/enum_params.hpp> | |||||
+#include <boost/preprocessor/repetition/enum_trailing.hpp> | |||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp> | |||||
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> | |||||
+#include <boost/preprocessor/repetition/repeat.hpp> | |||||
+#include <boost/preprocessor/repetition/repeat_from_to.hpp> | |||||
#include <boost/parameter/binding.hpp> | |||||
-#include <boost/mpl/apply.hpp> | |||||
+#include <boost/mpl/bool.hpp> | |||||
+#include <boost/mpl/if.hpp> | |||||
#include <boost/mpl/eval_if.hpp> | |||||
+#include <boost/mpl/apply.hpp> | |||||
+#include <boost/type_traits/remove_const.hpp> | |||||
#include <boost/type_traits/remove_reference.hpp> | |||||
#include <boost/accumulators/accumulators_fwd.hpp> | |||||
#include <boost/accumulators/framework/parameters/accumulator.hpp> | |||||
@@ -33,14 +40,24 @@ namespace detail | |||||
struct accumulator_set_result | |||||
{ | |||||
typedef typename as_feature<Feature>::type feature_type; | |||||
- typedef typename mpl::apply<AccumulatorSet, feature_type>::type::result_type type; | |||||
+ typedef typename mpl::apply< | |||||
+ typename boost::remove_const< | |||||
+ typename boost::remove_reference<AccumulatorSet>::type | |||||
+ >::type | |||||
+ , feature_type | |||||
+ >::type::result_type type; | |||||
}; | |||||
template<typename Args, typename Feature> | |||||
struct argument_pack_result | |||||
: accumulator_set_result< | |||||
- typename remove_reference< | |||||
- typename parameter::binding<Args, tag::accumulator>::type | |||||
+ typename boost::remove_reference< | |||||
+ typename parameter::binding< | |||||
+ typename boost::remove_const< | |||||
+ typename boost::remove_reference<Args>::type | |||||
+ >::type | |||||
+ , tag::accumulator | |||||
+ >::type | |||||
>::type | |||||
, Feature | |||||
> | |||||
@@ -147,6 +164,8 @@ struct extractor | |||||
, _ | |||||
) | |||||
+#undef BOOST_ACCUMULATORS_EXTRACTOR_FUN_OP | |||||
+ | |||||
#ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED | |||||
/// \overload | |||||
/// | |||||
@@ -156,6 +175,8 @@ struct extractor | |||||
#endif | |||||
}; | |||||
+}} // namespace boost::accumulators | |||||
+ | |||||
/// INTERNAL ONLY | |||||
/// | |||||
#define BOOST_ACCUMULATORS_ARRAY_REM(Array) \ | |||||
@@ -223,7 +244,5 @@ struct extractor | |||||
, BOOST_ACCUMULATORS_DEFINE_EXTRACTOR_FUN \ | |||||
, (3, (Tag, Feature, ParamSeq)) \ | |||||
) | |||||
- | |||||
-}} // namespace boost::accumulators | |||||
#endif | |||||
--- boost/accumulators/framework/parameters/accumulator.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/framework/parameters/accumulator.hpp | |||||
@@ -8,13 +8,13 @@ | |||||
#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_ACCUMULATOR_HPP_EAN_31_10_2005 | |||||
#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_ACCUMULATOR_HPP_EAN_31_10_2005 | |||||
-#include <boost/parameter/keyword.hpp> | |||||
+#include <boost/parameter/name.hpp> | |||||
#include <boost/accumulators/accumulators_fwd.hpp> | |||||
namespace boost { namespace accumulators | |||||
{ | |||||
-BOOST_PARAMETER_KEYWORD(tag, accumulator) | |||||
+BOOST_PARAMETER_NAME((accumulator, tag) accumulator) | |||||
BOOST_ACCUMULATORS_IGNORE_GLOBAL(accumulator) | |||||
}} // namespace boost::accumulators | |||||
--- boost/accumulators/framework/parameters/sample.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/framework/parameters/sample.hpp | |||||
@@ -8,13 +8,13 @@ | |||||
#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_SAMPLE_HPP_EAN_31_10_2005 | |||||
#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_SAMPLE_HPP_EAN_31_10_2005 | |||||
-#include <boost/parameter/keyword.hpp> | |||||
+#include <boost/parameter/name.hpp> | |||||
#include <boost/accumulators/accumulators_fwd.hpp> | |||||
namespace boost { namespace accumulators | |||||
{ | |||||
-BOOST_PARAMETER_KEYWORD(tag, sample) | |||||
+BOOST_PARAMETER_NAME((sample, tag) sample) | |||||
BOOST_ACCUMULATORS_IGNORE_GLOBAL(sample) | |||||
}} // namespace boost::accumulators | |||||
--- boost/accumulators/framework/parameters/weight.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/framework/parameters/weight.hpp | |||||
@@ -8,14 +8,14 @@ | |||||
#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHT_HPP_EAN_31_10_2005 | |||||
#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHT_HPP_EAN_31_10_2005 | |||||
-#include <boost/parameter/keyword.hpp> | |||||
+#include <boost/parameter/name.hpp> | |||||
#include <boost/accumulators/accumulators_fwd.hpp> | |||||
namespace boost { namespace accumulators | |||||
{ | |||||
// The weight of a single sample | |||||
-BOOST_PARAMETER_KEYWORD(tag, weight) | |||||
+BOOST_PARAMETER_NAME((weight, tag) weight) | |||||
BOOST_ACCUMULATORS_IGNORE_GLOBAL(weight) | |||||
}} // namespace boost::accumulators | |||||
--- boost/accumulators/framework/parameters/weights.hpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ boost/accumulators/framework/parameters/weights.hpp | |||||
@@ -8,14 +8,14 @@ | |||||
#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHTS_HPP_EAN_28_10_2005 | |||||
#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHTS_HPP_EAN_28_10_2005 | |||||
-#include <boost/parameter/keyword.hpp> | |||||
+#include <boost/parameter/name.hpp> | |||||
#include <boost/accumulators/accumulators_fwd.hpp> | |||||
namespace boost { namespace accumulators | |||||
{ | |||||
// The weight accumulator | |||||
-BOOST_PARAMETER_KEYWORD(tag, weights) | |||||
+BOOST_PARAMETER_NAME((weights, tag) weights) | |||||
BOOST_ACCUMULATORS_IGNORE_GLOBAL(weights) | |||||
}} // namespace boost::accumulators | |||||
--- libs/accumulators/test/Jamfile.v2.orig 2019-06-26 14:20:10 UTC | |||||
+++ libs/accumulators/test/Jamfile.v2 | |||||
@@ -26,7 +26,7 @@ project | |||||
<toolset>intel-win:<iterator_debugging>off | |||||
; | |||||
-test-suite "accumulators" | |||||
+alias accumulators_regular_tests | |||||
: [ run count.cpp ] | |||||
[ run covariance.cpp ] | |||||
[ run droppable.cpp ] | |||||
@@ -41,7 +41,6 @@ test-suite "accumulators" | |||||
[ run median.cpp ] | |||||
[ run min.cpp ] | |||||
[ run moment.cpp ] | |||||
- [ run pot_quantile.cpp ] | |||||
[ run p_square_cumul_dist.cpp ] | |||||
[ run p_square_quantile.cpp ] | |||||
[ run reference.cpp ] | |||||
@@ -54,8 +53,6 @@ test-suite "accumulators" | |||||
[ run tail.cpp ] | |||||
[ run tail_mean.cpp ] | |||||
[ run tail_quantile.cpp ] | |||||
- [ run tail_variate_means.cpp ] | |||||
- [ run valarray.cpp ] | |||||
[ run variance.cpp ] | |||||
[ run vector.cpp ] | |||||
[ run weighted_covariance.cpp ] | |||||
@@ -70,9 +67,69 @@ test-suite "accumulators" | |||||
[ run weighted_sum.cpp ] | |||||
[ run weighted_sum_kahan.cpp ] | |||||
[ run weighted_variance.cpp ] | |||||
+ ; | |||||
+ | |||||
+alias accumulators_test_valarray | |||||
+ : | |||||
+ : <target-os>linux | |||||
+ <toolset>clang | |||||
+# TODO: Find the correct attribute that detects libc++. | |||||
+ ; | |||||
+ | |||||
+alias accumulators_test_valarray | |||||
+ : | |||||
+ : <target-os>darwin | |||||
+ ; | |||||
+ | |||||
+alias accumulators_test_valarray | |||||
+ : [ run valarray.cpp ] | |||||
+ ; | |||||
+ | |||||
+alias accumulators_test_tail_variate_means | |||||
+ : | |||||
+ : <toolset>msvc | |||||
+ <toolset-msvc:version>14.0 | |||||
+ ; | |||||
+ | |||||
+alias accumulators_test_tail_variate_means | |||||
+ : [ run tail_variate_means.cpp ] | |||||
+ ; | |||||
+ | |||||
+alias accumulators_tests_pot_quantile_and_weighted_tail | |||||
+ : | |||||
+ : <target-os>linux | |||||
+ <toolset>gcc | |||||
+ <toolset-gcc:version>4.4.7 | |||||
+ ; | |||||
+ | |||||
+alias accumulators_tests_pot_quantile_and_weighted_tail | |||||
+ : [ run pot_quantile.cpp ] | |||||
[ run weighted_pot_quantile.cpp ] | |||||
[ run weighted_tail_mean.cpp ] | |||||
[ run weighted_tail_quantile.cpp ] | |||||
- [ run weighted_tail_variate_means.cpp ] | |||||
+ ; | |||||
+alias accumulators_test_weighted_tail_variate_means | |||||
+ : | |||||
+ : <target-os>linux | |||||
+ <toolset>gcc | |||||
+ <toolset-gcc:version>4.4.7 | |||||
+ ; | |||||
+ | |||||
+alias accumulators_test_weighted_tail_variate_means | |||||
+ : | |||||
+ : <toolset>msvc | |||||
+ <toolset-msvc:version>14.0 | |||||
+ ; | |||||
+ | |||||
+alias accumulators_test_weighted_tail_variate_means | |||||
+ : [ run weighted_tail_variate_means.cpp ] | |||||
+ ; | |||||
+ | |||||
+test-suite "accumulators" | |||||
+ : accumulators_regular_tests | |||||
+ accumulators_test_valarray | |||||
+ accumulators_test_tail_variate_means | |||||
+ accumulators_tests_pot_quantile_and_weighted_tail | |||||
+ accumulators_test_weighted_tail_variate_means | |||||
; | |||||
--- libs/accumulators/test/p_square_cumul_dist.cpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ libs/accumulators/test/p_square_cumul_dist.cpp | |||||
@@ -51,7 +51,7 @@ void test_stat() | |||||
boost::normal_distribution<> mean_sigma(0,1); | |||||
boost::variate_generator<boost::lagged_fibonacci607&, boost::normal_distribution<> > normal(rng, mean_sigma); | |||||
- for (std::size_t i=0; i<100000; ++i) | |||||
+ for (std::size_t i=0; i<1000000; ++i) | |||||
{ | |||||
acc(normal()); | |||||
} | |||||
--- libs/accumulators/test/weighted_median.cpp.orig 2019-06-26 14:20:10 UTC | |||||
+++ libs/accumulators/test/weighted_median.cpp | |||||
@@ -38,12 +38,17 @@ void test_stat() | |||||
acc_cdist( p_square_cumulative_distribution_num_cells = 100 ); | |||||
- for (std::size_t i=0; i<100000; ++i) | |||||
+ for (std::size_t i=0; i<1000000; ++i) | |||||
{ | |||||
double sample = normal_narrow(); | |||||
- acc(sample, weight = std::exp(0.5 * (sample - mu) * (sample - mu) * ( 1./sigma_narrow/sigma_narrow - 1./sigma/sigma ))); | |||||
- acc_dens(sample, weight = std::exp(0.5 * (sample - mu) * (sample - mu) * ( 1./sigma_narrow/sigma_narrow - 1./sigma/sigma ))); | |||||
- acc_cdist(sample, weight = std::exp(0.5 * (sample - mu) * (sample - mu) * ( 1./sigma_narrow/sigma_narrow - 1./sigma/sigma ))); | |||||
+ double w = std::exp( | |||||
+ 0.5 * (sample - mu) * (sample - mu) * ( | |||||
+ 1./sigma_narrow/sigma_narrow - 1./sigma/sigma | |||||
+ ) | |||||
+ ); | |||||
+ acc(sample, weight = w); | |||||
+ acc_dens(sample, weight = w); | |||||
+ acc_cdist(sample, weight = w); | |||||
} | |||||
BOOST_CHECK_CLOSE(1., weighted_median(acc), 2); |