update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -9,6 +9,8 @@
#define BOOST_ACCUMULATORS_ACCUMULATORS_FWD_HPP_EAN_28_10_2005 #define BOOST_ACCUMULATORS_ACCUMULATORS_FWD_HPP_EAN_28_10_2005
#include <boost/config.hpp> #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/apply_fwd.hpp> // for mpl::na
#include <boost/mpl/limits/vector.hpp> #include <boost/mpl/limits/vector.hpp>
#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/cat.hpp>
@@ -41,7 +43,6 @@
#endif #endif
#ifdef BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS #ifdef BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS
# include <boost/utility/enable_if.hpp>
# include <boost/type_traits/is_const.hpp> # include <boost/type_traits/is_const.hpp>
# define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)\ # define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)\
, typename boost::disable_if<boost::is_const<T> >::type * = 0 , 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 typename mpl::apply<AccumulatorSet, Feature>::type::result_type
extract_result(AccumulatorSet const &acc); extract_result(AccumulatorSet const &acc);
template<typename Feature, typename AccumulatorSet, typename A1> namespace detail
typename mpl::apply<AccumulatorSet, Feature>::type::result_type {
extract_result(AccumulatorSet const &acc, A1 const &a1); struct _enabler
{
};
}
// ... other overloads generated by Boost.Preprocessor: // ... other overloads generated by Boost.Preprocessor:
@@ -146,17 +150,37 @@ extract_result(AccumulatorSet const &acc, A1 const &a1);
extract_result( \ extract_result( \
AccumulatorSet const &acc \ AccumulatorSet const &acc \
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \ 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 /// INTERNAL ONLY
/// ///
BOOST_PP_REPEAT_FROM_TO( BOOST_PP_REPEAT_FROM_TO(
2 1
, BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS)
, BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD , BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD
, _ , _
) )
#undef BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD
#ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
template<typename Feature, typename AccumulatorSet, typename A1, typename A2 ...> template<typename Feature, typename AccumulatorSet, typename A1, typename A2 ...>
typename mpl::apply<AccumulatorSet, Feature>::type::result_type typename mpl::apply<AccumulatorSet, Feature>::type::result_type
@@ -185,6 +209,9 @@ namespace detail
struct is_accumulator_set; struct is_accumulator_set;
inline void ignore_variable(void const *) {} inline void ignore_variable(void const *) {}
}
}} // namespace boost::accumulators
#define BOOST_ACCUMULATORS_IGNORE_GLOBAL(X) \ #define BOOST_ACCUMULATORS_IGNORE_GLOBAL(X) \
namespace detail \ 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 #endif // include guard
// 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

View File

@@ -9,16 +9,23 @@
#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_SET_HPP_EAN_28_10_2005 #define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_SET_HPP_EAN_28_10_2005
#include <boost/version.hpp> #include <boost/version.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/apply.hpp> #include <boost/mpl/apply.hpp>
#include <boost/mpl/assert.hpp> #include <boost/mpl/assert.hpp>
#include <boost/mpl/protect.hpp> #include <boost/mpl/protect.hpp>
#include <boost/mpl/identity.hpp> #include <boost/mpl/identity.hpp>
#include <boost/mpl/is_sequence.hpp> #include <boost/mpl/is_sequence.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_base_and_derived.hpp> #include <boost/type_traits/is_base_of.hpp>
#include <boost/parameter/parameters.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/repeat_from_to.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_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/accumulators_fwd.hpp>
#include <boost/accumulators/framework/depends_on.hpp> #include <boost/accumulators/framework/depends_on.hpp>
#include <boost/accumulators/framework/accumulator_concept.hpp> #include <boost/accumulators/framework/accumulator_concept.hpp>
@@ -64,14 +71,6 @@ namespace detail
return accumulator_visitor<Args>(args); 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 // accumulator_set_base
struct accumulator_set_base struct accumulator_set_base
@@ -82,10 +81,38 @@ namespace detail
// is_accumulator_set // is_accumulator_set
template<typename T> template<typename T>
struct is_accumulator_set 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
{ {
}; };
// function object that serialize an accumulator
template<typename Archive>
struct serialize_accumulator
{
serialize_accumulator(Archive & _ar, const unsigned int _file_version) :
ar(_ar), file_version(_file_version)
{}
template<typename Accumulator>
void operator ()(Accumulator &accumulator)
{
accumulator.serialize(ar, file_version);
}
private:
Archive& ar;
const unsigned int file_version;
};
} // namespace detail } // namespace detail
#ifdef _MSC_VER #ifdef _MSC_VER
@@ -140,13 +167,13 @@ struct accumulator_set
: accumulators( : accumulators(
detail::make_acc_list( detail::make_acc_list(
accumulators_mpl_vector() accumulators_mpl_vector()
, detail::accumulator_params()(*this) , (boost::accumulators::accumulator = *this)
) )
) )
{ {
// Add-ref the Features that the user has specified // Add-ref the Features that the user has specified
this->template visit_if<detail::contains_feature_of_<Features> >( 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,17 +181,48 @@ struct accumulator_set
/// ///
/// \param a1 Optional named parameter to be passed to all the accumulators /// \param a1 Optional named parameter to be passed to all the accumulators
template<typename A1> template<typename A1>
explicit accumulator_set(A1 const &a1) explicit accumulator_set(
: accumulators( A1 const &a1
, typename boost::enable_if<
parameter::is_argument_pack<A1>
, detail::_enabler
>::type = detail::_enabler()
) : accumulators(
detail::make_acc_list( detail::make_acc_list(
accumulators_mpl_vector() accumulators_mpl_vector()
, detail::accumulator_params()(*this, a1) , (boost::accumulators::accumulator = *this, a1)
) )
) )
{ {
// Add-ref the Features that the user has specified // Add-ref the Features that the user has specified
this->template visit_if<detail::contains_feature_of_<Features> >( 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)
); );
} }
@@ -174,19 +232,47 @@ struct accumulator_set
/// ///
#define BOOST_ACCUMULATORS_ACCUMULATOR_SET_CTOR(z, n, _) \ #define BOOST_ACCUMULATORS_ACCUMULATOR_SET_CTOR(z, n, _) \
template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
accumulator_set(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a)) \ accumulator_set( \
: accumulators( \ 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( \ detail::make_acc_list( \
accumulators_mpl_vector() \ 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 */ \ /* Add-ref the Features that the user has specified */ \
this->template visit_if<detail::contains_feature_of_<Features> >( \ 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) \
); \ ); \
} }
@@ -239,17 +325,7 @@ struct accumulator_set
{ {
this->visit( this->visit(
detail::make_accumulator_visitor( 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)
) )
); );
} }
@@ -260,12 +336,37 @@ struct accumulator_set
/// ///
#define BOOST_ACCUMULATORS_ACCUMULATOR_SET_FUN_OP(z, n, _) \ #define BOOST_ACCUMULATORS_ACCUMULATOR_SET_FUN_OP(z, n, _) \
template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ 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( \ this->visit( \
detail::make_accumulator_visitor( \ 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) \
) \ ) \
) \ ) \
); \ ); \
@@ -274,7 +375,7 @@ struct accumulator_set
/// INTERNAL ONLY /// INTERNAL ONLY
/// ///
BOOST_PP_REPEAT_FROM_TO( BOOST_PP_REPEAT_FROM_TO(
2 1
, BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS)
, BOOST_ACCUMULATORS_ACCUMULATOR_SET_FUN_OP , BOOST_ACCUMULATORS_ACCUMULATOR_SET_FUN_OP
, _ , _
@@ -329,15 +430,23 @@ struct accumulator_set
the_feature; the_feature;
(*fusion::find_if<detail::matches_feature<Feature> >(this->accumulators)) (*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 // Also drop accumulators that this feature depends on
typedef typename the_feature::dependencies dependencies; typedef typename the_feature::dependencies dependencies;
this->template visit_if<detail::contains_feature_of_<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)
); );
} }
// make the accumulator set serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
detail::serialize_accumulator<Archive> serializer(ar, file_version);
fusion::for_each(this->accumulators, serializer);
}
private: private:
accumulators_type accumulators; accumulators_type accumulators;
@@ -365,6 +474,15 @@ find_accumulator(AccumulatorSet const &acc)
return acc.template extract<Feature>(); 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_result
// extract a result from an accumulator set // extract a result from an accumulator set
@@ -380,18 +498,43 @@ find_accumulator(AccumulatorSet const &acc)
extract_result( \ extract_result( \
AccumulatorSet const &acc \ AccumulatorSet const &acc \
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \ 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( \ return find_accumulator<Feature>(acc).result( \
detail::accumulator_params()( \ ( \
acc \ boost::accumulators::accumulator = acc \
BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \ 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_REPEAT_FROM_TO(
BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) 1
, BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS)
, BOOST_ACCUMULATORS_EXTRACT_RESULT_FUN , BOOST_ACCUMULATORS_EXTRACT_RESULT_FUN
, _ , _
) )

View File

@@ -34,7 +34,7 @@ namespace boost { namespace accumulators { namespace impl
template<typename Args> template<typename Args>
result_type result(Args const &args) const 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: private:

View File

@@ -31,7 +31,7 @@ namespace impl
template<typename Args> template<typename Args>
reference_accumulator_impl(Args const &args) reference_accumulator_impl(Args const &args)
: ref(args[parameter::keyword<Tag>::get()]) : ref(args[parameter::keyword<Tag>::instance])
{ {
} }

View File

@@ -30,7 +30,7 @@ namespace impl
template<typename Args> template<typename Args>
value_accumulator_impl(Args const &args) value_accumulator_impl(Args const &args)
: val(args[parameter::keyword<Tag>::get()]) : val(args[parameter::keyword<Tag>::instance])
{ {
} }

View File

@@ -266,11 +266,18 @@ namespace boost { namespace accumulators
template<typename Sequence, typename Args> template<typename Sequence, typename Args>
typename meta::make_acc_list<Sequence>::type 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)); 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));
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// checked_as_weighted_feature // checked_as_weighted_feature
template<typename Feature> template<typename Feature>

View File

@@ -8,6 +8,7 @@
#ifndef BOOST_ACCUMULATORS_FRAMEWORK_EXTRACTOR_HPP_EAN_28_10_2005 #ifndef BOOST_ACCUMULATORS_FRAMEWORK_EXTRACTOR_HPP_EAN_28_10_2005
#define 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/tuple/rem.hpp>
#include <boost/preprocessor/array/size.hpp> #include <boost/preprocessor/array/size.hpp>
#include <boost/preprocessor/array/data.hpp> #include <boost/preprocessor/array/data.hpp>
@@ -15,11 +16,17 @@
#include <boost/preprocessor/seq/to_array.hpp> #include <boost/preprocessor/seq/to_array.hpp>
#include <boost/preprocessor/seq/transform.hpp> #include <boost/preprocessor/seq/transform.hpp>
#include <boost/preprocessor/repetition/enum_params.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_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_binary_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/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/eval_if.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp> #include <boost/type_traits/remove_reference.hpp>
#include <boost/accumulators/accumulators_fwd.hpp> #include <boost/accumulators/accumulators_fwd.hpp>
#include <boost/accumulators/framework/parameters/accumulator.hpp> #include <boost/accumulators/framework/parameters/accumulator.hpp>
@@ -33,14 +40,24 @@ namespace detail
struct accumulator_set_result struct accumulator_set_result
{ {
typedef typename as_feature<Feature>::type feature_type; 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> template<typename Args, typename Feature>
struct argument_pack_result struct argument_pack_result
: accumulator_set_result< : accumulator_set_result<
typename remove_reference< typename boost::remove_reference<
typename parameter::binding<Args, tag::accumulator>::type typename parameter::binding<
typename boost::remove_const<
typename boost::remove_reference<Args>::type
>::type
, tag::accumulator
>::type
>::type >::type
, Feature , Feature
> >
@@ -147,6 +164,8 @@ struct extractor
, _ , _
) )
#undef BOOST_ACCUMULATORS_EXTRACTOR_FUN_OP
#ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
/// \overload /// \overload
/// ///
@@ -156,6 +175,8 @@ struct extractor
#endif #endif
}; };
}} // namespace boost::accumulators
/// INTERNAL ONLY /// INTERNAL ONLY
/// ///
#define BOOST_ACCUMULATORS_ARRAY_REM(Array) \ #define BOOST_ACCUMULATORS_ARRAY_REM(Array) \
@@ -224,6 +245,4 @@ struct extractor
, (3, (Tag, Feature, ParamSeq)) \ , (3, (Tag, Feature, ParamSeq)) \
) )
}} // namespace boost::accumulators
#endif #endif

View File

@@ -8,13 +8,13 @@
#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_ACCUMULATOR_HPP_EAN_31_10_2005 #ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_ACCUMULATOR_HPP_EAN_31_10_2005
#define 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> #include <boost/accumulators/accumulators_fwd.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
BOOST_PARAMETER_KEYWORD(tag, accumulator) BOOST_PARAMETER_NAME((accumulator, tag) accumulator)
BOOST_ACCUMULATORS_IGNORE_GLOBAL(accumulator) BOOST_ACCUMULATORS_IGNORE_GLOBAL(accumulator)
}} // namespace boost::accumulators }} // namespace boost::accumulators

View File

@@ -8,13 +8,13 @@
#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_SAMPLE_HPP_EAN_31_10_2005 #ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_SAMPLE_HPP_EAN_31_10_2005
#define 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> #include <boost/accumulators/accumulators_fwd.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
BOOST_PARAMETER_KEYWORD(tag, sample) BOOST_PARAMETER_NAME((sample, tag) sample)
BOOST_ACCUMULATORS_IGNORE_GLOBAL(sample) BOOST_ACCUMULATORS_IGNORE_GLOBAL(sample)
}} // namespace boost::accumulators }} // namespace boost::accumulators

View File

@@ -8,14 +8,14 @@
#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHT_HPP_EAN_31_10_2005 #ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHT_HPP_EAN_31_10_2005
#define 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> #include <boost/accumulators/accumulators_fwd.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
// The weight of a single sample // The weight of a single sample
BOOST_PARAMETER_KEYWORD(tag, weight) BOOST_PARAMETER_NAME((weight, tag) weight)
BOOST_ACCUMULATORS_IGNORE_GLOBAL(weight) BOOST_ACCUMULATORS_IGNORE_GLOBAL(weight)
}} // namespace boost::accumulators }} // namespace boost::accumulators

View File

@@ -8,14 +8,14 @@
#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHTS_HPP_EAN_28_10_2005 #ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHTS_HPP_EAN_28_10_2005
#define 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> #include <boost/accumulators/accumulators_fwd.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
// The weight accumulator // The weight accumulator
BOOST_PARAMETER_KEYWORD(tag, weights) BOOST_PARAMETER_NAME((weights, tag) weights)
BOOST_ACCUMULATORS_IGNORE_GLOBAL(weights) BOOST_ACCUMULATORS_IGNORE_GLOBAL(weights)
}} // namespace boost::accumulators }} // namespace boost::accumulators

View File

@@ -43,6 +43,13 @@ namespace impl
return this->cnt; return this->cnt;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & cnt;
}
private: private:
std::size_t cnt; std::size_t cnt;
}; };

View File

@@ -152,6 +152,13 @@ namespace impl
return this->cov_; return this->cov_;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & cov_;
}
private: private:
result_type cov_; result_type cov_;
}; };

View File

@@ -25,6 +25,8 @@
#include <boost/accumulators/statistics/count.hpp> #include <boost/accumulators/statistics/count.hpp>
#include <boost/accumulators/statistics/max.hpp> #include <boost/accumulators/statistics/max.hpp>
#include <boost/accumulators/statistics/min.hpp> #include <boost/accumulators/statistics/min.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/utility.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
@@ -184,6 +186,20 @@ namespace impl
return make_iterator_range(this->histogram); return make_iterator_range(this->histogram);
} }
// make this accumulator serializeable
// TODO split to save/load and check on parameters provided in ctor
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & cache_size;
ar & cache;
ar & num_bins;
ar & samples_in_bin;
ar & bin_positions;
ar & histogram;
ar & is_dirty;
}
private: private:
std::size_t cache_size; // number of cached samples std::size_t cache_size; // number of cached samples
array_type cache; // cache to store the first cache_size samples array_type cache; // cache to store the first cache_size samples

View File

@@ -26,6 +26,7 @@
#include <boost/accumulators/statistics_fwd.hpp> #include <boost/accumulators/statistics_fwd.hpp>
#include <boost/accumulators/statistics/count.hpp> #include <boost/accumulators/statistics/count.hpp>
#include <boost/accumulators/statistics/times2_iterator.hpp> #include <boost/accumulators/statistics/times2_iterator.hpp>
#include <boost/serialization/vector.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
@@ -236,6 +237,19 @@ namespace impl
); );
} }
public:
// make this accumulator serializeable
// TODO: do we need to split to load/save and verify that the parameters did not change?
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & probabilities;
ar & heights;
ar & actual_positions;
ar & desired_positions;
ar & positions_increments;
}
private: private:
array_type probabilities; // the quantile probabilities array_type probabilities; // the quantile probabilities
array_type heights; // q_i array_type heights; // q_i

View File

@@ -76,6 +76,7 @@ namespace impl
boost::begin(args[extended_p_square_probabilities]) boost::begin(args[extended_p_square_probabilities])
, boost::end(args[extended_p_square_probabilities]) , boost::end(args[extended_p_square_probabilities])
) )
, probability()
{ {
} }
@@ -185,6 +186,17 @@ namespace impl
} }
} }
public:
// make this accumulator serializeable
// TODO: do we need to split to load/save and verify that the parameters did not change?
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & probabilities;
ar & probability;
}
private: private:
array_type probabilities; array_type probabilities;

View File

@@ -63,6 +63,10 @@ namespace impl
* ( accumulators::moment<2>(args) - mean(args) * mean(args) ) * ( accumulators::moment<2>(args) - mean(args) * mean(args) )
) - 3.; ) - 3.;
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
} // namespace impl } // namespace impl

View File

@@ -48,6 +48,13 @@ namespace impl
return this->max_; return this->max_;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & max_;
}
private: private:
Sample max_; Sample max_;
}; };

View File

@@ -41,6 +41,10 @@ namespace impl
extractor<SumFeature> sum; extractor<SumFeature> sum;
return numeric::fdiv(sum(args), count(args)); return numeric::fdiv(sum(args), count(args));
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
template<typename Sample, typename Tag> template<typename Sample, typename Tag>
@@ -71,6 +75,12 @@ namespace impl
return this->mean; return this->mean;
} }
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & mean;
}
private: private:
result_type mean; result_type mean;
}; };

View File

@@ -48,6 +48,10 @@ namespace impl
{ {
return p_square_quantile_for_median(args); return p_square_quantile_for_median(args);
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// with_density_median_impl // with_density_median_impl
@@ -105,6 +109,16 @@ namespace impl
return this->median; return this->median;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sum;
ar & is_dirty;
ar & median;
}
private: private:
mutable float_type sum; mutable float_type sum;
mutable bool is_dirty; mutable bool is_dirty;
@@ -160,6 +174,15 @@ namespace impl
return this->median; return this->median;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & is_dirty;
ar & median;
}
private: private:
mutable bool is_dirty; mutable bool is_dirty;

View File

@@ -48,6 +48,13 @@ namespace impl
return this->min_; return this->min_;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & min_;
}
private: private:
Sample min_; Sample min_;
}; };

View File

@@ -75,6 +75,13 @@ namespace impl
return numeric::fdiv(this->sum, count(args)); return numeric::fdiv(this->sum, count(args));
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sum;
}
private: private:
Sample sum; Sample sum;
}; };

View File

@@ -20,6 +20,8 @@
#include <boost/accumulators/framework/parameters/sample.hpp> #include <boost/accumulators/framework/parameters/sample.hpp>
#include <boost/accumulators/statistics_fwd.hpp> #include <boost/accumulators/statistics_fwd.hpp>
#include <boost/accumulators/statistics/count.hpp> #include <boost/accumulators/statistics/count.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/utility.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
@@ -205,6 +207,20 @@ namespace impl
return make_iterator_range(this->histogram); return make_iterator_range(this->histogram);
} }
// make this accumulator serializeable
// TODO split to save/load and check on parameters provided in ctor
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & num_cells;
ar & heights;
ar & actual_positions;
ar & desired_positions;
ar & positions_increments;
ar & histogram;
ar & is_dirty;
}
private: private:
std::size_t num_cells; // number of cells b std::size_t num_cells; // number of cells b
array_type heights; // q_i array_type heights; // q_i

View File

@@ -8,9 +8,9 @@
#ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 #ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012
#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 #define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) #if defined(_MSC_VER) || defined(__BORLANDC__) && !defined(__clang__) || defined(__DMC__)
# pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp") # pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp")
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) #elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) || defined(__BORLANDC__)
# warning "This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp" # warning "This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp"
#endif #endif

View File

@@ -22,6 +22,7 @@
#include <boost/accumulators/statistics_fwd.hpp> #include <boost/accumulators/statistics_fwd.hpp>
#include <boost/accumulators/statistics/count.hpp> #include <boost/accumulators/statistics/count.hpp>
#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> #include <boost/accumulators/statistics/parameters/quantile_probability.hpp>
#include <boost/serialization/boost_array.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
@@ -61,7 +62,7 @@ namespace impl
template<typename Args> template<typename Args>
p_square_quantile_impl(Args const &args) p_square_quantile_impl(Args const &args)
: p(is_same<Impl, for_median>::value ? 0.5 : args[quantile_probability | 0.5]) : p(is_same<Impl, for_median>::value ? float_type(0.5) : args[quantile_probability | float_type(0.5)])
, heights() , heights()
, actual_positions() , actual_positions()
, desired_positions() , desired_positions()
@@ -69,20 +70,21 @@ namespace impl
{ {
for(std::size_t i = 0; i < 5; ++i) for(std::size_t i = 0; i < 5; ++i)
{ {
this->actual_positions[i] = i + 1.; this->actual_positions[i] = i + float_type(1.);
} }
this->desired_positions[0] = 1.; this->desired_positions[0] = float_type(1.);
this->desired_positions[1] = 1. + 2. * this->p; this->desired_positions[1] = float_type(1.) + float_type(2.) * this->p;
this->desired_positions[2] = 1. + 4. * this->p; this->desired_positions[2] = float_type(1.) + float_type(4.) * this->p;
this->desired_positions[3] = 3. + 2. * this->p; this->desired_positions[3] = float_type(3.) + float_type(2.) * this->p;
this->desired_positions[4] = 5.; this->desired_positions[4] = float_type(5.);
this->positions_increments[0] = 0.;
this->positions_increments[1] = this->p / 2.; this->positions_increments[0] = float_type(0.);
this->positions_increments[1] = this->p / float_type(2.);
this->positions_increments[2] = this->p; this->positions_increments[2] = this->p;
this->positions_increments[3] = (1. + this->p) / 2.; this->positions_increments[3] = (float_type(1.) + this->p) / float_type(2.);
this->positions_increments[4] = 1.; this->positions_increments[4] = float_type(1.);
} }
template<typename Args> template<typename Args>
@@ -156,7 +158,7 @@ namespace impl
float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; float_type hp = (this->heights[i + 1] - this->heights[i]) / dp;
float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; float_type hm = (this->heights[i - 1] - this->heights[i]) / dm;
if((d >= 1. && dp > 1.) || (d <= -1. && dm < -1.)) if((d >= float_type(1.) && dp > float_type(1.)) || (d <= float_type(-1.) && dm < float_type(-1.)))
{ {
short sign_d = static_cast<short>(d / std::abs(d)); short sign_d = static_cast<short>(d / std::abs(d));
@@ -171,11 +173,11 @@ namespace impl
else else
{ {
// use linear formula // use linear formula
if(d > 0) if(d > float_type(0))
{ {
this->heights[i] += hp; this->heights[i] += hp;
} }
if(d < 0) if(d < float_type(0))
{ {
this->heights[i] -= hm; this->heights[i] -= hm;
} }
@@ -191,6 +193,18 @@ namespace impl
return this->heights[2]; return this->heights[2];
} }
// make this accumulator serializeable
// TODO: do we need to split to load/save and verify that P did not change?
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & p;
ar & heights;
ar & actual_positions;
ar & desired_positions;
ar & positions_increments;
}
private: private:
float_type p; // the quantile probability p float_type p; // the quantile probability p
array_type heights; // q_i array_type heights; // q_i

View File

@@ -181,6 +181,21 @@ namespace impl
return this->fit_parameters_; return this->fit_parameters_;
} }
// make this accumulator serializeable
// TODO: do we need to split to load/save and verify that threshold did not change?
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & Nu_;
ar & mu_;
ar & sigma2_;
ar & threshold_;
ar & get<0>(fit_parameters_);
ar & get<1>(fit_parameters_);
ar & get<2>(fit_parameters_);
ar & is_dirty_;
}
private: private:
std::size_t Nu_; // number of samples larger than threshold std::size_t Nu_; // number of samples larger than threshold
mutable float_type mu_; // mean of Nu_ largest samples mutable float_type mu_; // mean of Nu_ largest samples
@@ -291,6 +306,20 @@ namespace impl
return this->fit_parameters_; return this->fit_parameters_;
} }
// make this accumulator serializeable
// TODO: do we need to split to load/save and verify that threshold did not change?
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & mu_;
ar & sigma2_;
ar & threshold_probability_;
ar & get<0>(fit_parameters_);
ar & get<1>(fit_parameters_);
ar & get<2>(fit_parameters_);
ar & is_dirty_;
}
private: private:
mutable float_type mu_; // mean of samples above threshold u mutable float_type mu_; // mean of samples above threshold u
mutable float_type sigma2_; // variance of samples above threshold u mutable float_type sigma2_; // variance of samples above threshold u

View File

@@ -81,6 +81,13 @@ namespace impl
) - 1.)); ) - 1.));
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sign_;
}
private: private:
short sign_; // if the fit parameters from the mirrored left tail extreme values are used, mirror back the result short sign_; // if the fit parameters from the mirrored left tail extreme values are used, mirror back the result
}; };

View File

@@ -90,6 +90,14 @@ namespace impl
is_same<LeftRight, left>::value ? args[quantile_probability] : 1. - args[quantile_probability] is_same<LeftRight, left>::value ? args[quantile_probability] : 1. - args[quantile_probability]
, -xi_hat); , -xi_hat);
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sign_;
}
private: private:
short sign_; // if the fit parameters from the mirrored left tail extreme values are used, mirror back the result short sign_; // if the fit parameters from the mirrored left tail extreme values are used, mirror back the result
}; };

View File

@@ -40,6 +40,10 @@ namespace impl
{ {
return static_cast<std::size_t>(rolling_window_plus1(args).size()) - is_rolling_window_plus1_full(args); return static_cast<std::size_t>(rolling_window_plus1(args).size()) - is_rolling_window_plus1_full(args);
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
} // namespace impl } // namespace impl

View File

@@ -43,6 +43,10 @@ namespace boost { namespace accumulators
{ {
return numeric::fdiv(rolling_sum(args), rolling_count(args)); return numeric::fdiv(rolling_sum(args), rolling_count(args));
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@@ -67,11 +71,17 @@ namespace boost { namespace accumulators
{ {
if(is_rolling_window_plus1_full(args)) if(is_rolling_window_plus1_full(args))
{ {
if (rolling_window_plus1(args).front() > args[sample])
mean_ -= numeric::fdiv(rolling_window_plus1(args).front()-args[sample],rolling_count(args));
else if (rolling_window_plus1(args).front() < args[sample])
mean_ += numeric::fdiv(args[sample]-rolling_window_plus1(args).front(),rolling_count(args)); mean_ += numeric::fdiv(args[sample]-rolling_window_plus1(args).front(),rolling_count(args));
} }
else else
{ {
result_type prev_mean = mean_; result_type prev_mean = mean_;
if (prev_mean > args[sample])
mean_ -= numeric::fdiv(prev_mean-args[sample],rolling_count(args));
else if (prev_mean < args[sample])
mean_ += numeric::fdiv(args[sample]-prev_mean,rolling_count(args)); mean_ += numeric::fdiv(args[sample]-prev_mean,rolling_count(args));
} }
} }
@@ -82,6 +92,13 @@ namespace boost { namespace accumulators
return mean_; return mean_;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & mean_;
}
private: private:
result_type mean_; result_type mean_;

View File

@@ -58,6 +58,13 @@ namespace impl
return numeric::fdiv(this->sum_, rolling_count(args)); return numeric::fdiv(this->sum_, rolling_count(args));
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sum_;
}
private: private:
result_type sum_; result_type sum_;
}; };

View File

@@ -51,6 +51,13 @@ namespace impl
return this->sum_; return this->sum_;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sum_;
}
private: private:
Sample sum_; Sample sum_;
}; };

View File

@@ -62,6 +62,10 @@ namespace impl
if (nr_samples < 2) return result_type(); if (nr_samples < 2) return result_type();
return nr_samples*(rolling_moment<2>(args) - mean*mean)/(nr_samples-1); return nr_samples*(rolling_moment<2>(args) - mean*mean)/(nr_samples-1);
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
//! Iterative calculation of the rolling variance. //! Iterative calculation of the rolling variance.
@@ -139,6 +143,14 @@ namespace impl
return numeric::fdiv(sum_of_squares_,(nr_samples-1)); return numeric::fdiv(sum_of_squares_,(nr_samples-1));
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & previous_mean_;
ar & sum_of_squares_;
}
private: private:
result_type previous_mean_; result_type previous_mean_;

View File

@@ -21,6 +21,45 @@
#include <boost/accumulators/framework/parameters/accumulator.hpp> #include <boost/accumulators/framework/parameters/accumulator.hpp>
#include <boost/accumulators/numeric/functional.hpp> #include <boost/accumulators/numeric/functional.hpp>
#include <boost/accumulators/statistics_fwd.hpp> #include <boost/accumulators/statistics_fwd.hpp>
#include <boost/serialization/split_free.hpp>
namespace boost { namespace serialization {
// implement serialization for boost::circular_buffer
template <class Archive, class T>
void save(Archive& ar, const circular_buffer<T>& b, const unsigned int /* version */)
{
typename circular_buffer<T>::size_type size = b.size();
ar << b.capacity();
ar << size;
const typename circular_buffer<T>::const_array_range one = b.array_one();
const typename circular_buffer<T>::const_array_range two = b.array_two();
ar.save_binary(one.first, one.second*sizeof(T));
ar.save_binary(two.first, two.second*sizeof(T));
}
template <class Archive, class T>
void load(Archive& ar, circular_buffer<T>& b, const unsigned int /* version */)
{
typename circular_buffer<T>::capacity_type capacity;
typename circular_buffer<T>::size_type size;
ar >> capacity;
b.set_capacity(capacity);
ar >> size;
b.clear();
const typename circular_buffer<T>::pointer buff = new T[size*sizeof(T)];
ar.load_binary(buff, size*sizeof(T));
b.insert(b.begin(), buff, buff+size);
delete[] buff;
}
template<class Archive, class T>
inline void serialize(Archive & ar, circular_buffer<T>& b, const unsigned int version)
{
split_free(ar, b, version);
}
} } // end namespace boost::serialization
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
@@ -83,6 +122,12 @@ namespace impl
return result_type(this->buffer_.begin(), this->buffer_.end()); return result_type(this->buffer_.begin(), this->buffer_.end());
} }
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & buffer_;
}
private: private:
circular_buffer<Sample> buffer_; circular_buffer<Sample> buffer_;
}; };
@@ -112,6 +157,10 @@ namespace impl
{ {
return rolling_window_plus1(args).advance_begin(is_rolling_window_plus1_full(args)); return rolling_window_plus1(args).advance_begin(is_rolling_window_plus1_full(args));
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
} // namespace impl } // namespace impl

View File

@@ -65,6 +65,10 @@ namespace impl
* std::sqrt( accumulators::moment<2>(args) - mean(args) * mean(args) ) * std::sqrt( accumulators::moment<2>(args) - mean(args) * mean(args) )
); );
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
} // namespace impl } // namespace impl

View File

@@ -51,8 +51,13 @@ namespace impl
return this->sum; return this->sum;
} }
private: template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sum;
}
private:
Sample sum; Sample sum;
}; };

View File

@@ -66,6 +66,14 @@ struct sum_kahan_impl
return this->sum; return this->sum;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sum;
ar & compensation;
}
private: private:
Sample sum; Sample sum;
Sample compensation; Sample compensation;

View File

@@ -268,6 +268,17 @@ namespace impl
std::vector<Sample> const &samples; std::vector<Sample> const &samples;
}; };
public:
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & is_sorted;
ar & indices;
ar & samples;
}
private:
mutable bool is_sorted; mutable bool is_sorted;
mutable std::vector<std::size_t> indices; mutable std::vector<std::size_t> indices;
std::vector<Sample> samples; std::vector<Sample> samples;

View File

@@ -88,6 +88,10 @@ namespace impl
- numeric::fdiv(n, count(args)) - numeric::fdiv(n, count(args))
); );
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@@ -159,6 +163,10 @@ namespace impl
} }
} }
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
} // namespace impl } // namespace impl

View File

@@ -98,6 +98,10 @@ namespace impl
} }
} }
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
} // namespace impl } // namespace impl

View File

@@ -18,6 +18,7 @@
#include <boost/accumulators/framework/depends_on.hpp> #include <boost/accumulators/framework/depends_on.hpp>
#include <boost/accumulators/statistics_fwd.hpp> #include <boost/accumulators/statistics_fwd.hpp>
#include <boost/accumulators/statistics/tail.hpp> #include <boost/accumulators/statistics/tail.hpp>
#include <boost/serialization/vector.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
@@ -69,6 +70,14 @@ namespace impl
); );
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & variates;
}
private:
std::vector<VariateType> variates; std::vector<VariateType> variates;
}; };

View File

@@ -27,6 +27,7 @@
#include <boost/accumulators/statistics/tail_variate.hpp> #include <boost/accumulators/statistics/tail_variate.hpp>
#include <boost/accumulators/statistics/tail_mean.hpp> #include <boost/accumulators/statistics/tail_mean.hpp>
#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> #include <boost/accumulators/statistics/parameters/quantile_probability.hpp>
#include <boost/serialization/vector.hpp>
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(push) # pragma warning(push)
@@ -145,6 +146,13 @@ namespace impl
return make_iterator_range(this->tail_means_); return make_iterator_range(this->tail_means_);
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & tail_means_;
}
private: private:
mutable array_type tail_means_; mutable array_type tail_means_;

View File

@@ -53,6 +53,10 @@ namespace impl
result_type tmp = mean(args); result_type tmp = mean(args);
return accumulators::moment<2>(args) - tmp * tmp; return accumulators::moment<2>(args) - tmp * tmp;
} }
// serialization is done by accumulators it depends on
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version) {}
}; };
//! Iterative calculation of variance. //! Iterative calculation of variance.
@@ -113,6 +117,13 @@ namespace impl
return this->variance; return this->variance;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & variance;
}
private: private:
result_type variance; result_type variance;
}; };

View File

@@ -97,6 +97,13 @@ namespace impl
return this->cov_; return this->cov_;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & cov_;
}
private: private:
result_type cov_; result_type cov_;
}; };

View File

@@ -23,6 +23,8 @@
#include <boost/accumulators/statistics/max.hpp> #include <boost/accumulators/statistics/max.hpp>
#include <boost/accumulators/statistics/min.hpp> #include <boost/accumulators/statistics/min.hpp>
#include <boost/accumulators/statistics/density.hpp> // for named parameters density_cache_size and density_num_bins #include <boost/accumulators/statistics/density.hpp> // for named parameters density_cache_size and density_num_bins
#include <boost/serialization/vector.hpp>
#include <boost/serialization/utility.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
@@ -171,6 +173,20 @@ namespace impl
return make_iterator_range(this->histogram); return make_iterator_range(this->histogram);
} }
// make this accumulator serializeable
// TODO split to save/load and check on parameters provided in ctor
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & cache_size;
ar & cache;
ar & num_bins;
ar & samples_in_bin;
ar & bin_positions;
ar & histogram;
ar & is_dirty;
}
private: private:
std::size_t cache_size; // number of cached samples std::size_t cache_size; // number of cached samples
histogram_type cache; // cache to store the first cache_size samples with their weights as std::pair histogram_type cache; // cache to store the first cache_size samples with their weights as std::pair

View File

@@ -28,6 +28,7 @@
#include <boost/accumulators/statistics/sum.hpp> #include <boost/accumulators/statistics/sum.hpp>
#include <boost/accumulators/statistics/times2_iterator.hpp> #include <boost/accumulators/statistics/times2_iterator.hpp>
#include <boost/accumulators/statistics/extended_p_square.hpp> #include <boost/accumulators/statistics/extended_p_square.hpp>
#include <boost/serialization/vector.hpp>
namespace boost { namespace accumulators namespace boost { namespace accumulators
{ {
@@ -251,6 +252,17 @@ namespace impl
); );
} }
// make this accumulator serializeable
// TODO: do we need to split to load/save and verify that the parameters did not change?
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & probabilities;
ar & heights;
ar & actual_positions;
ar & desired_positions;
}
private: private:
array_type probabilities; // the quantile probabilities array_type probabilities; // the quantile probabilities
array_type heights; // q_i array_type heights; // q_i

View File

@@ -97,6 +97,13 @@ namespace impl
return this->mean; return this->mean;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & mean;
}
private: private:
result_type mean; result_type mean;
}; };

View File

@@ -106,6 +106,15 @@ namespace impl
return this->median; return this->median;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sum;
ar & is_dirty;
ar & median;
}
private: private:
mutable float_type sum; mutable float_type sum;
mutable bool is_dirty; mutable bool is_dirty;
@@ -162,6 +171,15 @@ namespace impl
return this->median; return this->median;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & is_dirty;
ar & median;
}
private: private:
mutable bool is_dirty; mutable bool is_dirty;
mutable float_type median; mutable float_type median;

View File

@@ -60,6 +60,13 @@ namespace impl
return numeric::fdiv(this->sum, sum_of_weights(args)); return numeric::fdiv(this->sum, sum_of_weights(args));
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sum;
}
private: private:
weighted_sample sum; weighted_sample sum;
}; };

View File

@@ -221,6 +221,19 @@ namespace impl
return make_iterator_range(this->histogram); return make_iterator_range(this->histogram);
} }
// make this accumulator serializeable
// TODO split to save/load and check on parameters provided in ctor
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & num_cells;
ar & heights;
ar & actual_positions;
ar & desired_positions;
ar & histogram;
ar & is_dirty;
}
private: private:
std::size_t num_cells; // number of cells b std::size_t num_cells; // number of cells b
array_type heights; // q_i array_type heights; // q_i

View File

@@ -8,9 +8,9 @@
#ifndef BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 #ifndef BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012
#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 #define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) #if defined(_MSC_VER) || defined(__BORLANDC__) && !defined(__clang__) || defined(__DMC__)
# pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp") # pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp")
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) #elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) || defined(__BORLANDC__)
# warning "This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp" # warning "This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp"
#endif #endif

View File

@@ -208,6 +208,17 @@ namespace impl {
return this->heights[2]; return this->heights[2];
} }
// make this accumulator serializeable
// TODO split to save/load and check on parameters provided in ctor
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & p;
ar & heights;
ar & actual_positions;
ar & desired_positions;
}
private: private:
float_type p; // the quantile probability p float_type p; // the quantile probability p
array_type heights; // q_i array_type heights; // q_i

View File

@@ -109,6 +109,19 @@ namespace impl
return this->fit_parameters_; return this->fit_parameters_;
} }
// make this accumulator serializeable
// TODO: do we need to split to load/save and verify that threshold did not change?
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & sign_;
ar & mu_;
ar & sigma2_;
ar & threshold_;
ar & fit_parameters_;
ar & is_dirty_;
}
private: private:
short sign_; // for left tail fitting, mirror the extreme values short sign_; // for left tail fitting, mirror the extreme values
mutable float_type mu_; // mean of samples above threshold mutable float_type mu_; // mean of samples above threshold

View File

@@ -55,6 +55,13 @@ namespace impl
return this->weighted_sum_; return this->weighted_sum_;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & weighted_sum_;
}
private: private:
weighted_sample weighted_sum_; weighted_sample weighted_sum_;

View File

@@ -68,6 +68,14 @@ namespace impl
return this->weighted_sum_; return this->weighted_sum_;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & weighted_sum_;
ar & compensation;
}
private: private:
weighted_sample weighted_sum_; weighted_sample weighted_sum_;
weighted_sample compensation; weighted_sample compensation;

View File

@@ -179,6 +179,13 @@ namespace impl
return make_iterator_range(this->tail_means_); return make_iterator_range(this->tail_means_);
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & tail_means_;
}
private: private:
mutable array_type tail_means_; mutable array_type tail_means_;

View File

@@ -103,6 +103,13 @@ namespace impl
return this->weighted_variance; return this->weighted_variance;
} }
// make this accumulator serializeable
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & weighted_variance;
}
private: private:
result_type weighted_variance; result_type weighted_variance;
}; };

View File

@@ -19,7 +19,8 @@
#include <functional> // for plus and multiplies #include <functional> // for plus and multiplies
#include <boost/utility/enable_if.hpp> // for boost::disable_if #include <boost/config.hpp>
#include <boost/core/enable_if.hpp> // for boost::disable_if
#include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_integral.hpp>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {

View File

@@ -19,8 +19,8 @@
#define BOOST_ALGORITHM_APPLY_PERMUTATION_HPP #define BOOST_ALGORITHM_APPLY_PERMUTATION_HPP
#include <algorithm> #include <algorithm>
#include <type_traits>
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@@ -23,16 +23,17 @@
#include <iterator> // For std::iterator_traits #include <iterator> // For std::iterator_traits
#include <cassert> #include <cassert>
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/mpl/identity.hpp> // for identity #include <boost/type_traits/type_identity.hpp> // for boost::type_identity
#include <boost/utility/enable_if.hpp> // for boost::disable_if #include <boost/core/enable_if.hpp> // for boost::disable_if
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
/// \fn clamp ( T const& val, /// \fn clamp ( T const& val,
/// typename boost::mpl::identity<T>::type const & lo, /// typename boost::type_identity<T>::type const & lo,
/// typename boost::mpl::identity<T>::type const & hi, Pred p ) /// typename boost::type_identity<T>::type const & hi, Pred p )
/// \return the value "val" brought into the range [ lo, hi ] /// \return the value "val" brought into the range [ lo, hi ]
/// using the comparison predicate p. /// using the comparison predicate p.
/// If p ( val, lo ) return lo. /// If p ( val, lo ) return lo.
@@ -47,8 +48,8 @@ namespace boost { namespace algorithm {
/// ///
template<typename T, typename Pred> template<typename T, typename Pred>
BOOST_CXX14_CONSTEXPR T const & clamp ( T const& val, BOOST_CXX14_CONSTEXPR T const & clamp ( T const& val,
typename boost::mpl::identity<T>::type const & lo, typename boost::type_identity<T>::type const & lo,
typename boost::mpl::identity<T>::type const & hi, Pred p ) typename boost::type_identity<T>::type const & hi, Pred p )
{ {
// assert ( !p ( hi, lo )); // Can't assert p ( lo, hi ) b/c they might be equal // assert ( !p ( hi, lo )); // Can't assert p ( lo, hi ) b/c they might be equal
return p ( val, lo ) ? lo : p ( hi, val ) ? hi : val; return p ( val, lo ) ? lo : p ( hi, val ) ? hi : val;
@@ -56,8 +57,8 @@ namespace boost { namespace algorithm {
/// \fn clamp ( T const& val, /// \fn clamp ( T const& val,
/// typename boost::mpl::identity<T>::type const & lo, /// typename boost::identity<T>::type const & lo,
/// typename boost::mpl::identity<T>::type const & hi ) /// typename boost::identity<T>::type const & hi )
/// \return the value "val" brought into the range [ lo, hi ]. /// \return the value "val" brought into the range [ lo, hi ].
/// If the value is less than lo, return lo. /// If the value is less than lo, return lo.
/// If the value is greater than "hi", return hi. /// If the value is greater than "hi", return hi.
@@ -69,8 +70,8 @@ namespace boost { namespace algorithm {
/// ///
template<typename T> template<typename T>
BOOST_CXX14_CONSTEXPR T const& clamp ( const T& val, BOOST_CXX14_CONSTEXPR T const& clamp ( const T& val,
typename boost::mpl::identity<T>::type const & lo, typename boost::type_identity<T>::type const & lo,
typename boost::mpl::identity<T>::type const & hi ) typename boost::type_identity<T>::type const & hi )
{ {
return boost::algorithm::clamp ( val, lo, hi, std::less<T>()); return boost::algorithm::clamp ( val, lo, hi, std::less<T>());
} }

View File

@@ -12,6 +12,7 @@
#ifndef BOOST_ALGORITHM_ALL_OF_HPP #ifndef BOOST_ALGORITHM_ALL_OF_HPP
#define BOOST_ALGORITHM_ALL_OF_HPP #define BOOST_ALGORITHM_ALL_OF_HPP
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@@ -14,6 +14,7 @@
#ifndef BOOST_ALGORITHM_ANY_OF_HPP #ifndef BOOST_ALGORITHM_ANY_OF_HPP
#define BOOST_ALGORITHM_ANY_OF_HPP #define BOOST_ALGORITHM_ANY_OF_HPP
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@@ -13,6 +13,8 @@
#define BOOST_ALGORITHM_COPY_IF_HPP #define BOOST_ALGORITHM_COPY_IF_HPP
#include <utility> // for std::pair, std::make_pair #include <utility> // for std::pair, std::make_pair
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
@@ -124,6 +126,86 @@ copy_until ( const Range &r, OutputIterator result, Predicate p )
return boost::algorithm::copy_until (boost::begin (r), boost::end(r), result, p); return boost::algorithm::copy_until (boost::begin (r), boost::end(r), result, p);
} }
/// \fn copy_if_while ( InputIterator first, InputIterator last, OutputIterator result, CopyPredicate copy_pred, TerminatePred term_pred )
/// \brief Copies all the elements from the input range that satisfy the
/// copy predicate to the output range while the termination predicate is
/// satisfied.
/// \return The updated output iterator
///
/// \param first The start of the input sequence
/// \param last One past the end of the input sequence
/// \param result An output iterator to write the results into
/// \param copy_pred A predicate for testing whether to the current element
/// \param term_pred A predicate for testing whether to end the copy operation
template<typename InputIterator, typename OutputIterator, typename CopyPredicate, typename TerminatePred>
BOOST_CXX14_CONSTEXPR std::pair<InputIterator, OutputIterator>
copy_if_while ( InputIterator first, InputIterator last, OutputIterator result, CopyPredicate copy_pred, TerminatePred term_pred)
{
for ( ; first != last && term_pred(*first); ++first ) {
if (copy_pred(*first)) {
*result++ = *first;
}
}
return std::make_pair(first, result);
}
/// \fn copy_if_while ( const Range& r, OutputIterator result, CopyPredicate copy_pred, TerminatePred term_pred )
/// \brief Copies all the elements from the input range that satisfy the
/// copy predicate to the output range while the termination predicate is
/// satisfied.
/// \return The updated output iterator
///
/// \param r The input range
/// \param result An output iterator to write the results into
/// \param copy_pred A predicate for testing whether to the current element
/// \param term_pred A predicate for testing whether to end the copy operation
template<typename Range, typename OutputIterator, typename CopyPredicate, typename TerminatePred>
BOOST_CXX14_CONSTEXPR std::pair<typename boost::range_iterator<const Range>::type, OutputIterator>
copy_if_while ( const Range& r, OutputIterator result, CopyPredicate copy_pred, TerminatePred term_pred)
{
return boost::algorithm::copy_if_while(boost::begin(r), boost::end(r), result, copy_pred, term_pred);
}
/// \fn copy_if_until ( InputIterator first, InputIterator last, OutputIterator result, CopyPredicate copy_pred, TerminatePred term_pred )
/// \brief Copies all the elements from the input range that satisfy the
/// copy predicate to the output range until the termination predicate is
/// satisfied.
/// \return The updated output iterator
///
/// \param first The start of the input sequence
/// \param last One past the end of the input sequence
/// \param result An output iterator to write the results into
/// \param copy_pred A predicate for testing whether to the current element
/// \param term_pred A predicate for testing whether to end the copy operation
template<typename InputIterator, typename OutputIterator, typename CopyPredicate, typename TerminatePred>
BOOST_CXX14_CONSTEXPR std::pair<InputIterator, OutputIterator>
copy_if_until ( InputIterator first, InputIterator last, OutputIterator result, CopyPredicate copy_pred, TerminatePred term_pred)
{
for ( ; first != last && !term_pred(*first); ++first ) {
if (copy_pred(*first)) {
*result++ = *first;
}
}
return std::make_pair(first, result);
}
/// \fn copy_if_until ( const Range& r, OutputIterator result, CopyPredicate copy_pred, TerminatePred term_pred )
/// \brief Copies all the elements from the input range that satisfy the
/// copy predicate to the output range until the termination predicate is
/// satisfied.
/// \return The updated output iterator
///
/// \param r The input range
/// \param result An output iterator to write the results into
/// \param copy_pred A predicate for testing whether to the current element
/// \param term_pred A predicate for testing whether to end the copy operation
template<typename Range, typename OutputIterator, typename CopyPredicate, typename TerminatePred>
BOOST_CXX14_CONSTEXPR std::pair<typename boost::range_iterator<const Range>::type, OutputIterator>
copy_if_until ( const Range& r, OutputIterator result, CopyPredicate copy_pred, TerminatePred term_pred)
{
return boost::algorithm::copy_if_until(boost::begin(r), boost::end(r), result, copy_pred, term_pred);
}
}} // namespace boost and algorithm }} // namespace boost and algorithm
#endif // BOOST_ALGORITHM_COPY_IF_HPP #endif // BOOST_ALGORITHM_COPY_IF_HPP

View File

@@ -12,6 +12,8 @@
#ifndef BOOST_ALGORITHM_COPY_N_HPP #ifndef BOOST_ALGORITHM_COPY_N_HPP
#define BOOST_ALGORITHM_COPY_N_HPP #define BOOST_ALGORITHM_COPY_N_HPP
#include <boost/config.hpp>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
/// \fn copy_n ( InputIterator first, Size n, OutputIterator result ) /// \fn copy_n ( InputIterator first, Size n, OutputIterator result )

View File

@@ -12,6 +12,7 @@
#ifndef BOOST_ALGORITHM_FIND_IF_NOT_HPP #ifndef BOOST_ALGORITHM_FIND_IF_NOT_HPP
#define BOOST_ALGORITHM_FIND_IF_NOT_HPP #define BOOST_ALGORITHM_FIND_IF_NOT_HPP
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@@ -12,6 +12,7 @@
#ifndef BOOST_ALGORITHM_IOTA_HPP #ifndef BOOST_ALGORITHM_IOTA_HPP
#define BOOST_ALGORITHM_IOTA_HPP #define BOOST_ALGORITHM_IOTA_HPP
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@@ -12,6 +12,7 @@
#ifndef BOOST_ALGORITHM_IS_PARTITIONED_HPP #ifndef BOOST_ALGORITHM_IS_PARTITIONED_HPP
#define BOOST_ALGORITHM_IS_PARTITIONED_HPP #define BOOST_ALGORITHM_IS_PARTITIONED_HPP
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@@ -17,9 +17,10 @@
#include <functional> // for std::equal_to #include <functional> // for std::equal_to
#include <iterator> #include <iterator>
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/core/enable_if.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {

View File

@@ -16,12 +16,13 @@
#include <functional> #include <functional>
#include <iterator> #include <iterator>
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/core/enable_if.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/mpl/identity.hpp> #include <boost/type_traits/type_identity.hpp> // for boost::type_identity
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
@@ -126,7 +127,7 @@ namespace boost { namespace algorithm {
/// \param p A binary predicate that returns true if two elements are ordered. /// \param p A binary predicate that returns true if two elements are ordered.
/// ///
template <typename R, typename Pred> template <typename R, typename Pred>
BOOST_CXX14_CONSTEXPR typename boost::lazy_disable_if_c< boost::is_same<R, Pred>::value, boost::mpl::identity<bool> >::type BOOST_CXX14_CONSTEXPR typename boost::lazy_disable_if_c< boost::is_same<R, Pred>::value, boost::type_identity<bool> >::type
is_sorted ( const R &range, Pred p ) is_sorted ( const R &range, Pred p )
{ {
return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range ), p ); return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range ), p );

View File

@@ -12,6 +12,7 @@
#ifndef BOOST_ALGORITHM_NONE_OF_HPP #ifndef BOOST_ALGORITHM_NONE_OF_HPP
#define BOOST_ALGORITHM_NONE_OF_HPP #define BOOST_ALGORITHM_NONE_OF_HPP
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@@ -12,11 +12,13 @@
#ifndef BOOST_ALGORITHM_ONE_OF_HPP #ifndef BOOST_ALGORITHM_ONE_OF_HPP
#define BOOST_ALGORITHM_ONE_OF_HPP #define BOOST_ALGORITHM_ONE_OF_HPP
#include <boost/algorithm/cxx11/none_of.hpp> #include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/algorithm/cxx11/none_of.hpp>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
/// \fn one_of ( InputIterator first, InputIterator last, Predicate p ) /// \fn one_of ( InputIterator first, InputIterator last, Predicate p )

View File

@@ -14,6 +14,7 @@
#include <iterator> // for std::distance, advance #include <iterator> // for std::distance, advance
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@@ -14,6 +14,8 @@
#include <iterator> #include <iterator>
#include <boost/config.hpp>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
namespace detail { namespace detail {

View File

@@ -16,6 +16,7 @@
#include <functional> // for std::equal_to #include <functional> // for std::equal_to
#include <iterator> #include <iterator>
#include <boost/config.hpp>
#include <boost/algorithm/cxx11/is_permutation.hpp> #include <boost/algorithm/cxx11/is_permutation.hpp>
#include <boost/algorithm/cxx14/mismatch.hpp> #include <boost/algorithm/cxx14/mismatch.hpp>

View File

@@ -13,6 +13,7 @@
#define BOOST_ALGORITHM_MISMATCH_HPP #define BOOST_ALGORITHM_MISMATCH_HPP
#include <utility> // for std::pair #include <utility> // for std::pair
#include <boost/config.hpp> #include <boost/config.hpp>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {

View File

@@ -15,6 +15,7 @@
#include <functional> // for std::plus #include <functional> // for std::plus
#include <iterator> // for std::iterator_traits #include <iterator> // for std::iterator_traits
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>

View File

@@ -14,6 +14,8 @@
#include <utility> // for std::pair #include <utility> // for std::pair
#include <boost/config.hpp>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
/// \fn for_each_n(InputIterator first, Size n, Function f); /// \fn for_each_n(InputIterator first, Size n, Function f);

View File

@@ -9,12 +9,13 @@
/// \brief Combine the (transformed) elements of a sequence (or two) into a single value. /// \brief Combine the (transformed) elements of a sequence (or two) into a single value.
/// \author Marshall Clow /// \author Marshall Clow
#ifndef BOOST_ALGORITHM_TRANSFORM_REDUCE_HPP #ifndef BOOST_ALGORITHM_INCLUSIVE_SCAN_HPP
#define BOOST_ALGORITHM_TRANSFORM_REDUCE_HPP #define BOOST_ALGORITHM_INCLUSIVE_SCAN_HPP
#include <functional> // for std::plus #include <functional> // for std::plus
#include <iterator> // for std::iterator_traits #include <iterator> // for std::iterator_traits
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>
@@ -57,4 +58,4 @@ OutputIterator inclusive_scan(InputIterator first, InputIterator last,
}} // namespace boost and algorithm }} // namespace boost and algorithm
#endif // BOOST_ALGORITHM_TRANSFORM_REDUCE_HPP #endif // BOOST_ALGORITHM_INCLUSIVE_SCAN_HPP

View File

@@ -15,6 +15,7 @@
#include <functional> // for std::plus #include <functional> // for std::plus
#include <iterator> // for std::iterator_traits #include <iterator> // for std::iterator_traits
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>

View File

@@ -15,12 +15,28 @@
#include <functional> // for std::plus #include <functional> // for std::plus
#include <iterator> // for std::iterator_traits #include <iterator> // for std::iterator_traits
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
/// \fn transform_exclusive_scan ( InputIterator first, InputIterator last, OutputIterator result, BinaryOperation bOp, UnaryOperation uOp, T init )
/// \brief Transforms elements from the input range with uOp and then combines
/// those transformed elements with bOp such that the n-1th element and the nth
/// element are combined. Exclusivity means that the nth element is not
/// included in the nth combination.
/// \return The updated output iterator
///
/// \param first The start of the input sequence
/// \param last The end of the input sequence
/// \param result The output iterator to write the results into
/// \param bOp The operation for combining transformed input elements
/// \param uOp The operation for transforming input elements
/// \param init The initial value
///
/// \note This function is part of the C++17 standard library
template<class InputIterator, class OutputIterator, class T, template<class InputIterator, class OutputIterator, class T,
class BinaryOperation, class UnaryOperation> class BinaryOperation, class UnaryOperation>
OutputIterator transform_exclusive_scan(InputIterator first, InputIterator last, OutputIterator transform_exclusive_scan(InputIterator first, InputIterator last,

View File

@@ -15,12 +15,28 @@
#include <functional> // for std::plus #include <functional> // for std::plus
#include <iterator> // for std::iterator_traits #include <iterator> // for std::iterator_traits
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
/// \fn transform_inclusive_scan ( InputIterator first, InputIterator last, OutputIterator result, BinaryOperation bOp, UnaryOperation uOp, T init )
/// \brief Transforms elements from the input range with uOp and then combines
/// those transformed elements with bOp such that the n-1th element and the nth
/// element are combined. Inclusivity means that the nth element is included in
/// the nth combination.
/// \return The updated output iterator
///
/// \param first The start of the input sequence
/// \param last The end of the input sequence
/// \param result The output iterator to write the results into
/// \param bOp The operation for combining transformed input elements
/// \param uOp The operation for transforming input elements
/// \param init The initial value
///
/// \note This function is part of the C++17 standard library
template<class InputIterator, class OutputIterator, template<class InputIterator, class OutputIterator,
class BinaryOperation, class UnaryOperation, class T> class BinaryOperation, class UnaryOperation, class T>
OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last, OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
@@ -36,6 +52,20 @@ OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
return result; return result;
} }
/// \fn transform_inclusive_scan ( InputIterator first, InputIterator last, OutputIterator result, BinaryOperation bOp, UnaryOperation uOp, T init )
/// \brief Transforms elements from the input range with uOp and then combines
/// those transformed elements with bOp such that the n-1th element and the nth
/// element are combined. Inclusivity means that the nth element is included in
/// the nth combination. The first value will be used as the init.
/// \return The updated output iterator
///
/// \param first The start of the input sequence
/// \param last The end of the input sequence
/// \param result The output iterator to write the results into
/// \param bOp The operation for combining transformed input elements
/// \param uOp The operation for transforming input elements
///
/// \note This function is part of the C++17 standard library
template<class InputIterator, class OutputIterator, template<class InputIterator, class OutputIterator,
class BinaryOperation, class UnaryOperation> class BinaryOperation, class UnaryOperation>
OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last, OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,

View File

@@ -15,6 +15,7 @@
#include <functional> // for std::plus #include <functional> // for std::plus
#include <iterator> // for std::iterator_traits #include <iterator> // for std::iterator_traits
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>

View File

@@ -2,18 +2,17 @@
Copyright (c) T. Zachary Laine 2018. Copyright (c) T. Zachary Laine 2018.
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE10.txt or copy at http://www.boost.org/LICENSE10.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/ */
#ifndef BOOST_ALGORITHM_FIND_BACKWARD_HPP #ifndef BOOST_ALGORITHM_FIND_BACKWARD_HPP
#define BOOST_ALGORITHM_FIND_BACKWARD_HPP #define BOOST_ALGORITHM_FIND_BACKWARD_HPP
#include <utility>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <utility>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
template<typename BidiIter, typename T> template<typename BidiIter, typename T>

View File

@@ -2,18 +2,17 @@
Copyright (c) T. Zachary Laine 2018. Copyright (c) T. Zachary Laine 2018.
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE10.txt or copy at http://www.boost.org/LICENSE10.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/ */
#ifndef BOOST_ALGORITHM_FIND_NOT_HPP #ifndef BOOST_ALGORITHM_FIND_NOT_HPP
#define BOOST_ALGORITHM_FIND_NOT_HPP #define BOOST_ALGORITHM_FIND_NOT_HPP
#include <utility>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <utility>
namespace boost { namespace algorithm { namespace boost { namespace algorithm {
template<typename InputIter, typename Sentinel, typename T> template<typename InputIter, typename Sentinel, typename T>

View File

@@ -22,8 +22,10 @@
#include <algorithm> // for std::stable_partition #include <algorithm> // for std::stable_partition
#include <functional> #include <functional>
#include <utility> // for std::make_pair
#include <boost/bind.hpp> // for boost::bind #include <boost/config.hpp>
#include <boost/bind/bind.hpp> // for boost::bind
#include <boost/range/begin.hpp> // for boost::begin(range) #include <boost/range/begin.hpp> // for boost::begin(range)
#include <boost/range/end.hpp> // for boost::end(range) #include <boost/range/end.hpp> // for boost::end(range)
@@ -80,13 +82,14 @@ namespace boost { namespace algorithm {
*/ */
template < template <
typename BidirectionalIterator, // Iter models BidirectionalIterator typename BidirectionalIterator, // models BidirectionalIterator
typename Pred> // Pred models UnaryPredicate typename Pred> // models UnaryPredicate
std::pair<BidirectionalIterator, BidirectionalIterator> gather std::pair<BidirectionalIterator, BidirectionalIterator> gather
( BidirectionalIterator first, BidirectionalIterator last, BidirectionalIterator pivot, Pred pred ) ( BidirectionalIterator first, BidirectionalIterator last, BidirectionalIterator pivot, Pred pred )
{ {
// The first call partitions everything up to (but not including) the pivot element, // The first call partitions everything up to (but not including) the pivot element,
// while the second call partitions the rest of the sequence. // while the second call partitions the rest of the sequence.
using namespace boost::placeholders;
return std::make_pair ( return std::make_pair (
std::stable_partition ( first, pivot, !boost::bind<bool> ( pred, _1 )), std::stable_partition ( first, pivot, !boost::bind<bool> ( pred, _1 )),
std::stable_partition ( pivot, last, boost::bind<bool> ( pred, _1 ))); std::stable_partition ( pivot, last, boost::bind<bool> ( pred, _1 )));
@@ -103,11 +106,11 @@ template <
typename BidirectionalRange, // typename BidirectionalRange, //
typename Pred> // Pred models UnaryPredicate typename Pred> // Pred models UnaryPredicate
std::pair< std::pair<
typename boost::range_iterator<const BidirectionalRange>::type, typename boost::range_iterator<BidirectionalRange>::type,
typename boost::range_iterator<const BidirectionalRange>::type> typename boost::range_iterator<BidirectionalRange>::type>
gather ( gather (
const BidirectionalRange &range, BidirectionalRange &range,
typename boost::range_iterator<const BidirectionalRange>::type pivot, typename boost::range_iterator<BidirectionalRange>::type pivot,
Pred pred ) Pred pred )
{ {
return boost::algorithm::gather ( boost::begin ( range ), boost::end ( range ), pivot, pred ); return boost::algorithm::gather ( boost::begin ( range ), boost::end ( range ), pivot, pred );

View File

@@ -23,13 +23,14 @@
#include <iterator> // for std::iterator_traits #include <iterator> // for std::iterator_traits
#include <stdexcept> #include <stdexcept>
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/exception/exception.hpp> #include <boost/exception/exception.hpp>
#include <boost/exception/info.hpp> #include <boost/exception/info.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/core/enable_if.hpp>
#include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_integral.hpp>
@@ -47,9 +48,9 @@ namespace boost { namespace algorithm {
\brief Thrown when the input sequence unexpectedly ends \brief Thrown when the input sequence unexpectedly ends
*/ */
struct hex_decode_error : virtual boost::exception, virtual std::exception {}; struct BOOST_SYMBOL_VISIBLE hex_decode_error : virtual boost::exception, virtual std::exception {};
struct not_enough_input : virtual hex_decode_error {}; struct BOOST_SYMBOL_VISIBLE not_enough_input : virtual hex_decode_error {};
struct non_hex_input : virtual hex_decode_error {}; struct BOOST_SYMBOL_VISIBLE non_hex_input : virtual hex_decode_error {};
typedef boost::error_info<struct bad_char_,char> bad_char; typedef boost::error_info<struct bad_char_,char> bad_char;
namespace detail { namespace detail {

View File

@@ -0,0 +1,72 @@
/*
Copyright (c) Ivan Matek, Marshall Clow 2021.
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
/// \file is_clamped.hpp
/// \brief IsClamped algorithm
/// \authors Ivan Matek, Marshall Clow
///
#ifndef BOOST_ALGORITHM_IS_CLAMPED_HPP
#define BOOST_ALGORITHM_IS_CLAMPED_HPP
#include <functional> // for std::less
#include <cassert>
#include <boost/type_traits/type_identity.hpp> // for boost::type_identity
namespace boost { namespace algorithm {
/// \fn is_clamped ( T const& val,
/// typename boost::type_identity<T>::type const & lo,
/// typename boost::type_identity<T>::type const & hi, Pred p )
/// \returns true if value "val" is in the range [ lo, hi ]
/// using the comparison predicate p.
/// If p ( val, lo ) return false.
/// If p ( hi, val ) return false.
/// Otherwise, returns true.
///
/// \param val The value to be checked
/// \param lo The lower bound of the range
/// \param hi The upper bound of the range
/// \param p A predicate to use to compare the values.
/// p ( a, b ) returns a boolean.
///
template <typename T, typename Pred>
BOOST_CXX14_CONSTEXPR bool is_clamped(
T const& val, typename boost::type_identity<T>::type const& lo,
typename boost::type_identity<T>::type const& hi, Pred p) {
// assert ( !p ( hi, lo )); // Can't assert p ( lo, hi ) b/c they
// might be equal
return p(val, lo) ? false : p(hi, val) ? false : true;
}
/// \fn is_clamped ( T const& val,
/// typename boost::type_identity<T>::type const & lo,
/// typename boost::type_identity<T>::type const & hi)
/// \returns true if value "val" is in the range [ lo, hi ]
/// using operator < for comparison.
/// If the value is less than lo, return false.
/// If the value is greater than hi, return false.
/// Otherwise, returns true.
///
/// \param val The value to be checked
/// \param lo The lower bound of the range
/// \param hi The upper bound of the range
///
template<typename T>
BOOST_CXX14_CONSTEXPR bool is_clamped ( const T& val,
typename boost::type_identity<T>::type const & lo,
typename boost::type_identity<T>::type const & hi )
{
return boost::algorithm::is_clamped ( val, lo, hi, std::less<T>());
}
}}
#endif // BOOST_ALGORITHM_CLAMP_HPP

View File

@@ -19,6 +19,7 @@
#include <functional> #include <functional>
#include <cstring> #include <cstring>
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
@@ -112,7 +113,7 @@ bool is_palindrome(const R& range, Predicate p)
/// \note This function will return true for empty sequences and for palindromes. /// \note This function will return true for empty sequences and for palindromes.
/// For other sequences function will return false. /// For other sequences function will return false.
/// Complexity: O(N). /// Complexity: O(N).
bool is_palindrome(const char* str) inline bool is_palindrome(const char* str)
{ {
if(!str) if(!str)
return true; return true;

View File

@@ -12,6 +12,7 @@
#ifndef BOOST_ALGORITHM_IS_PARTITIONED_UNTIL_HPP #ifndef BOOST_ALGORITHM_IS_PARTITIONED_UNTIL_HPP
#define BOOST_ALGORITHM_IS_PARTITIONED_UNTIL_HPP #define BOOST_ALGORITHM_IS_PARTITIONED_UNTIL_HPP
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@@ -25,6 +25,7 @@
* *
*/ */
#include <boost/config.hpp>
#include <boost/tuple/tuple.hpp> // for using pairs with boost::cref #include <boost/tuple/tuple.hpp> // for using pairs with boost::cref
#include <boost/ref.hpp> #include <boost/ref.hpp>

View File

@@ -28,6 +28,8 @@
#include <utility> // for std::pair and std::make_pair #include <utility> // for std::pair and std::make_pair
#include <boost/config.hpp>
namespace boost { namespace boost {
namespace detail { // for obtaining a uniform version of minmax_element namespace detail { // for obtaining a uniform version of minmax_element

View File

@@ -12,13 +12,14 @@
#include <iterator> // for std::iterator_traits #include <iterator> // for std::iterator_traits
#include <boost/config.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/core/enable_if.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/algorithm/searching/detail/bm_traits.hpp> #include <boost/algorithm/searching/detail/bm_traits.hpp>

View File

@@ -12,13 +12,14 @@
#include <iterator> // for std::iterator_traits #include <iterator> // for std::iterator_traits
#include <boost/config.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/core/enable_if.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/algorithm/searching/detail/bm_traits.hpp> #include <boost/algorithm/searching/detail/bm_traits.hpp>

View File

@@ -13,13 +13,14 @@
#include <vector> #include <vector>
#include <iterator> // for std::iterator_traits #include <iterator> // for std::iterator_traits
#include <boost/config.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/core/enable_if.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/algorithm/searching/detail/debugging.hpp> #include <boost/algorithm/searching/detail/debugging.hpp>

View File

@@ -22,6 +22,7 @@
#include <iterator> // For std::iterator_traits #include <iterator> // For std::iterator_traits
#include <algorithm> // For nth_element and partial_sort #include <algorithm> // For nth_element and partial_sort
#include <boost/config.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>

View File

@@ -65,7 +65,7 @@ namespace boost {
template< typename T1, typename T2 > template< typename T1, typename T2 >
bool operator()( const T1& Arg1, const T2& Arg2 ) const bool operator()( const T1& Arg1, const T2& Arg2 ) const
{ {
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
return std::toupper(Arg1)==std::toupper(Arg2); return std::toupper(Arg1)==std::toupper(Arg2);
#else #else
return std::toupper<T1>(Arg1,m_Loc)==std::toupper<T2>(Arg2,m_Loc); return std::toupper<T1>(Arg1,m_Loc)==std::toupper<T2>(Arg2,m_Loc);
@@ -118,7 +118,7 @@ namespace boost {
template< typename T1, typename T2 > template< typename T1, typename T2 >
bool operator()( const T1& Arg1, const T2& Arg2 ) const bool operator()( const T1& Arg1, const T2& Arg2 ) const
{ {
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
return std::toupper(Arg1)<std::toupper(Arg2); return std::toupper(Arg1)<std::toupper(Arg2);
#else #else
return std::toupper<T1>(Arg1,m_Loc)<std::toupper<T2>(Arg2,m_Loc); return std::toupper<T1>(Arg1,m_Loc)<std::toupper<T2>(Arg2,m_Loc);
@@ -171,7 +171,7 @@ namespace boost {
template< typename T1, typename T2 > template< typename T1, typename T2 >
bool operator()( const T1& Arg1, const T2& Arg2 ) const bool operator()( const T1& Arg1, const T2& Arg2 ) const
{ {
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
return std::toupper(Arg1)<=std::toupper(Arg2); return std::toupper(Arg1)<=std::toupper(Arg2);
#else #else
return std::toupper<T1>(Arg1,m_Loc)<=std::toupper<T2>(Arg2,m_Loc); return std::toupper<T1>(Arg1,m_Loc)<=std::toupper<T2>(Arg2,m_Loc);

View File

@@ -15,6 +15,9 @@
#include <locale> #include <locale>
#include <functional> #include <functional>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/type_traits/make_unsigned.hpp> #include <boost/type_traits/make_unsigned.hpp>
namespace boost { namespace boost {
@@ -40,7 +43,7 @@ namespace boost {
// Operation // Operation
CharT operator ()( CharT Ch ) const CharT operator ()( CharT Ch ) const
{ {
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
return std::tolower( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch )); return std::tolower( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
#else #else
return std::tolower<CharT>( Ch, *m_Loc ); return std::tolower<CharT>( Ch, *m_Loc );
@@ -62,7 +65,7 @@ namespace boost {
// Operation // Operation
CharT operator ()( CharT Ch ) const CharT operator ()( CharT Ch ) const
{ {
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
return std::toupper( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch )); return std::toupper( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
#else #else
return std::toupper<CharT>( Ch, *m_Loc ); return std::toupper<CharT>( Ch, *m_Loc );

View File

@@ -13,10 +13,12 @@
#include <boost/algorithm/string/config.hpp> #include <boost/algorithm/string/config.hpp>
#include <algorithm> #include <algorithm>
#include <cstring>
#include <functional> #include <functional>
#include <locale> #include <locale>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/distance.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/algorithm/string/predicate_facade.hpp> #include <boost/algorithm/string/predicate_facade.hpp>
@@ -45,7 +47,7 @@ namespace boost {
return std::use_facet< std::ctype<CharT> >(m_Locale).is( m_Type, Ch ); return std::use_facet< std::ctype<CharT> >(m_Locale).is( m_Type, Ch );
} }
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x582) && !defined(_USE_OLD_RW_STL) #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x582) && !defined(_USE_OLD_RW_STL)
template<> template<>
bool operator()( char const Ch ) const bool operator()( char const Ch ) const
{ {

View File

@@ -18,6 +18,8 @@
#include <boost/algorithm/string/detail/find_format_store.hpp> #include <boost/algorithm/string/detail/find_format_store.hpp>
#include <boost/algorithm/string/detail/replace_storage.hpp> #include <boost/algorithm/string/detail/replace_storage.hpp>
#include <deque>
namespace boost { namespace boost {
namespace algorithm { namespace algorithm {
namespace detail { namespace detail {

View File

@@ -40,10 +40,18 @@ namespace boost {
// Protected construction/destruction // Protected construction/destruction
// Default constructor // Default constructor
find_iterator_base() {} BOOST_DEFAULTED_FUNCTION(find_iterator_base(), {})
// Copy construction // Copy construction
find_iterator_base( const find_iterator_base& Other ) : BOOST_DEFAULTED_FUNCTION(find_iterator_base( const find_iterator_base& Other ), :
m_Finder(Other.m_Finder) {} m_Finder(Other.m_Finder) {}
)
// Assignment
BOOST_DEFAULTED_FUNCTION(find_iterator_base& operator=( const find_iterator_base& Other ), {
m_Finder = Other.m_Finder;
return *this;
})
// Constructor // Constructor
template<typename FinderT> template<typename FinderT>
@@ -51,7 +59,7 @@ namespace boost {
m_Finder(Finder) {} m_Finder(Finder) {}
// Destructor // Destructor
~find_iterator_base() {} BOOST_DEFAULTED_FUNCTION(~find_iterator_base(), {})
// Find operation // Find operation
match_type do_find( match_type do_find(

Some files were not shown because too many files have changed in this diff Show More