Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2008-02-18 01:16:28


Author: eric_niebler
Date: 2008-02-18 01:16:27 EST (Mon, 18 Feb 2008)
New Revision: 43300
URL: http://svn.boost.org/trac/boost/changeset/43300

Log:
remove dependence on boost.lambda, make numeric function objects work with std binders
Text files modified:
   trunk/boost/accumulators/numeric/functional.hpp | 11 +++++++++--
   trunk/boost/accumulators/statistics/covariance.hpp | 1 -
   trunk/boost/accumulators/statistics/peaks_over_threshold.hpp | 1 -
   trunk/boost/accumulators/statistics/pot_quantile.hpp | 11 +++++------
   trunk/boost/accumulators/statistics/pot_tail_mean.hpp | 1 -
   trunk/boost/accumulators/statistics/tail_variate_means.hpp | 5 +----
   trunk/boost/accumulators/statistics/weighted_covariance.hpp | 1 -
   trunk/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp | 1 -
   trunk/boost/accumulators/statistics/weighted_tail_variate_means.hpp | 5 +----
   9 files changed, 16 insertions(+), 21 deletions(-)

Modified: trunk/boost/accumulators/numeric/functional.hpp
==============================================================================
--- trunk/boost/accumulators/numeric/functional.hpp (original)
+++ trunk/boost/accumulators/numeric/functional.hpp 2008-02-18 01:16:27 EST (Mon, 18 Feb 2008)
@@ -97,7 +97,10 @@
         }; \
         template<typename Arg, typename EnableIf> \
         struct Name ## _base \
- : std::unary_function<Arg, typename result_of_ ## Name<Arg>::type> \
+ : std::unary_function< \
+ typename remove_const<Arg>::type \
+ , typename result_of_ ## Name<Arg>::type \
+ > \
         { \
             typename result_of_ ## Name<Arg>::type operator ()(Arg &arg) const \
             { \
@@ -133,7 +136,11 @@
         }; \
         template<typename Left, typename Right, typename EnableIf> \
         struct Name ## _base \
- : std::binary_function<Left, Right, typename result_of_ ## Name<Left, Right>::type> \
+ : std::binary_function< \
+ typename remove_const<Left>::type \
+ , typename remove_const<Right>::type \
+ , typename result_of_ ## Name<Left, Right>::type \
+ > \
         { \
             typename result_of_ ## Name<Left, Right>::type \
             operator ()(Left &left, Right &right) const \

Modified: trunk/boost/accumulators/statistics/covariance.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/covariance.hpp (original)
+++ trunk/boost/accumulators/statistics/covariance.hpp 2008-02-18 01:16:27 EST (Mon, 18 Feb 2008)
@@ -18,7 +18,6 @@
 #include <boost/range.hpp>
 #include <boost/parameter/keyword.hpp>
 #include <boost/mpl/placeholders.hpp>
-#include <boost/lambda/lambda.hpp>
 #include <boost/numeric/ublas/io.hpp>
 #include <boost/numeric/ublas/matrix.hpp>
 #include <boost/type_traits/is_scalar.hpp>

Modified: trunk/boost/accumulators/statistics/peaks_over_threshold.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/peaks_over_threshold.hpp (original)
+++ trunk/boost/accumulators/statistics/peaks_over_threshold.hpp 2008-02-18 01:16:27 EST (Mon, 18 Feb 2008)
@@ -22,7 +22,6 @@
 #include <boost/mpl/placeholders.hpp>
 #include <boost/parameter/keyword.hpp>
 #include <boost/tuple/tuple.hpp>
-#include <boost/lambda/lambda.hpp>
 #include <boost/accumulators/framework/accumulator_base.hpp>
 #include <boost/accumulators/framework/extractor.hpp>
 #include <boost/accumulators/numeric/functional.hpp>

Modified: trunk/boost/accumulators/statistics/pot_quantile.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/pot_quantile.hpp (original)
+++ trunk/boost/accumulators/statistics/pot_quantile.hpp 2008-02-18 01:16:27 EST (Mon, 18 Feb 2008)
@@ -17,7 +17,6 @@
 #include <boost/mpl/if.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/mpl/placeholders.hpp>
-#include <boost/lambda/lambda.hpp>
 #include <boost/accumulators/framework/accumulator_base.hpp>
 #include <boost/accumulators/framework/extractor.hpp>
 #include <boost/accumulators/numeric/functional.hpp>
@@ -55,7 +54,7 @@
         typedef float_type result_type;
 
         pot_quantile_impl(dont_care)
- : sign_((is_same<LeftRight, left>::value) ? -1 : 1)
+ : sign_((is_same<LeftRight, left>::value) ? -1 : 1)
         {
         }
 
@@ -76,10 +75,10 @@
             float_type beta_bar = some_peaks_over_threshold(args).template get<1>();
             float_type xi_hat = some_peaks_over_threshold(args).template get<2>();
 
- return this->sign_*(u_bar + beta_bar/xi_hat * ( std::pow(
- is_same<LeftRight, left>::value ? args[quantile_probability] : 1. - args[quantile_probability]
- , -xi_hat
- ) - 1.));
+ return this->sign_ * (u_bar + beta_bar/xi_hat * ( std::pow(
+ is_same<LeftRight, left>::value ? args[quantile_probability] : 1. - args[quantile_probability]
+ , -xi_hat
+ ) - 1.));
         }
 
     private:

Modified: trunk/boost/accumulators/statistics/pot_tail_mean.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/pot_tail_mean.hpp (original)
+++ trunk/boost/accumulators/statistics/pot_tail_mean.hpp 2008-02-18 01:16:27 EST (Mon, 18 Feb 2008)
@@ -18,7 +18,6 @@
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/placeholders.hpp>
 #include <boost/type_traits/is_same.hpp>
-#include <boost/lambda/lambda.hpp>
 #include <boost/accumulators/framework/accumulator_base.hpp>
 #include <boost/accumulators/framework/extractor.hpp>
 #include <boost/accumulators/numeric/functional.hpp>

Modified: trunk/boost/accumulators/statistics/tail_variate_means.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/tail_variate_means.hpp (original)
+++ trunk/boost/accumulators/statistics/tail_variate_means.hpp 2008-02-18 01:16:27 EST (Mon, 18 Feb 2008)
@@ -15,7 +15,6 @@
 #include <sstream>
 #include <stdexcept>
 #include <boost/throw_exception.hpp>
-#include <boost/lambda/lambda.hpp>
 #include <boost/parameter/keyword.hpp>
 #include <boost/mpl/placeholders.hpp>
 #include <boost/type_traits/is_same.hpp>
@@ -110,13 +109,11 @@
 
                 float_type factor = n * ( (is_same<Impl, relative>::value) ? non_coherent_tail_mean(args) : 1. );
 
- using boost::lambda::_1;
-
                 std::transform(
                     this->tail_means_.begin()
                   , this->tail_means_.end()
                   , this->tail_means_.begin()
- , _1 / factor
+ , std::bind2nd(std::divides<float_type>(), factor)
                 );
             }
             else

Modified: trunk/boost/accumulators/statistics/weighted_covariance.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/weighted_covariance.hpp (original)
+++ trunk/boost/accumulators/statistics/weighted_covariance.hpp 2008-02-18 01:16:27 EST (Mon, 18 Feb 2008)
@@ -18,7 +18,6 @@
 #include <boost/range.hpp>
 #include <boost/parameter/keyword.hpp>
 #include <boost/mpl/placeholders.hpp>
-#include <boost/lambda/lambda.hpp>
 #include <boost/numeric/ublas/io.hpp>
 #include <boost/numeric/ublas/matrix.hpp>
 #include <boost/type_traits/is_scalar.hpp>

Modified: trunk/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp (original)
+++ trunk/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp 2008-02-18 01:16:27 EST (Mon, 18 Feb 2008)
@@ -17,7 +17,6 @@
 #include <boost/mpl/placeholders.hpp>
 #include <boost/parameter/keyword.hpp>
 #include <boost/tuple/tuple.hpp>
-#include <boost/lambda/lambda.hpp>
 #include <boost/accumulators/numeric/functional.hpp>
 #include <boost/accumulators/framework/accumulator_base.hpp>
 #include <boost/accumulators/framework/extractor.hpp>

Modified: trunk/boost/accumulators/statistics/weighted_tail_variate_means.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/weighted_tail_variate_means.hpp (original)
+++ trunk/boost/accumulators/statistics/weighted_tail_variate_means.hpp 2008-02-18 01:16:27 EST (Mon, 18 Feb 2008)
@@ -15,7 +15,6 @@
 #include <sstream>
 #include <stdexcept>
 #include <boost/throw_exception.hpp>
-#include <boost/lambda/lambda.hpp>
 #include <boost/parameter/keyword.hpp>
 #include <boost/mpl/placeholders.hpp>
 #include <boost/type_traits/is_same.hpp>
@@ -161,13 +160,11 @@
 
             float_type factor = sum * ( (is_same<Impl, relative>::value) ? non_coherent_weighted_tail_mean(args) : 1. );
 
- using boost::lambda::_1;
-
             std::transform(
                 this->tail_means_.begin()
               , this->tail_means_.end()
               , this->tail_means_.begin()
- , _1 / factor
+ , std::bind2nd(numeric::functional::divides<typename array_type::value_type const, float_type const>(), factor)
             );
 
             return make_iterator_range(this->tail_means_);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk