Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2008-02-19 02:14:38


Author: eric_niebler
Date: 2008-02-19 02:14:37 EST (Tue, 19 Feb 2008)
New Revision: 43312
URL: http://svn.boost.org/trac/boost/changeset/43312

Log:
fix droppable accumulators
Text files modified:
   trunk/boost/accumulators/framework/accumulators/droppable_accumulator.hpp | 3 ++-
   trunk/boost/accumulators/statistics/mean.hpp | 38 ++++++++++++++++++--------------------
   trunk/boost/accumulators/statistics/variance.hpp | 39 ++++++++++++++++++---------------------
   trunk/boost/accumulators/statistics/weighted_variance.hpp | 38 ++++++++++++++++++--------------------
   trunk/libs/accumulators/doc/accumulators.qbk | 6 ++----
   5 files changed, 58 insertions(+), 66 deletions(-)

Modified: trunk/boost/accumulators/framework/accumulators/droppable_accumulator.hpp
==============================================================================
--- trunk/boost/accumulators/framework/accumulators/droppable_accumulator.hpp (original)
+++ trunk/boost/accumulators/framework/accumulators/droppable_accumulator.hpp 2008-02-19 02:14:37 EST (Tue, 19 Feb 2008)
@@ -102,6 +102,7 @@
     struct droppable_accumulator_base
       : Accumulator
     {
+ typedef droppable_accumulator_base base;
         typedef mpl::true_ is_droppable;
         typedef typename Accumulator::result_type result_type;
 
@@ -156,7 +157,7 @@
     {
         template<typename Args>
         droppable_accumulator(Args const &args)
- : droppable_accumulator_base<Accumulator>(args)
+ : droppable_accumulator::base(args)
         {
         }
     };

Modified: trunk/boost/accumulators/statistics/mean.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/mean.hpp (original)
+++ trunk/boost/accumulators/statistics/mean.hpp 2008-02-19 02:14:37 EST (Tue, 19 Feb 2008)
@@ -271,26 +271,24 @@
 {
 };
 
-////////////////////////////////////////////////////////////////////////////
-//// droppable_accumulator<mean_impl>
-//// need to specialize droppable lazy mean to cache the result at the
-//// point the accumulator is dropped.
-///// INTERNAL ONLY
-/////
-//template<typename Sample, typename SumFeature>
-//struct droppable_accumulator<impl::mean_impl<Sample, SumFeature> >
-// : droppable_accumulator_base<
-// with_cached_result<impl::mean_impl<Sample, SumFeature> >
-// >
-//{
-// template<typename Args>
-// droppable_accumulator(Args const &args)
-// : droppable_accumulator_base<
-// with_cached_result<impl::mean_impl<Sample, SumFeature> >
-// >(args)
-// {
-// }
-//};
+//////////////////////////////////////////////////////////////////////////
+// droppable_accumulator<mean_impl>
+// need to specialize droppable lazy mean to cache the result at the
+// point the accumulator is dropped.
+/// INTERNAL ONLY
+///
+template<typename Sample, typename SumFeature>
+struct droppable_accumulator<impl::mean_impl<Sample, SumFeature> >
+ : droppable_accumulator_base<
+ with_cached_result<impl::mean_impl<Sample, SumFeature> >
+ >
+{
+ template<typename Args>
+ droppable_accumulator(Args const &args)
+ : droppable_accumulator::base(args)
+ {
+ }
+};
 
 }} // namespace boost::accumulators
 

Modified: trunk/boost/accumulators/statistics/variance.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/variance.hpp (original)
+++ trunk/boost/accumulators/statistics/variance.hpp 2008-02-19 02:14:37 EST (Tue, 19 Feb 2008)
@@ -208,27 +208,24 @@
 {
 };
 
-
-////////////////////////////////////////////////////////////////////////////
-//// droppable_accumulator<variance_impl>
-//// need to specialize droppable lazy variance to cache the result at the
-//// point the accumulator is dropped.
-///// INTERNAL ONLY
-/////
-//template<typename Sample, typename MeanFeature>
-//struct droppable_accumulator<impl::variance_impl<Sample, MeanFeature> >
-// : droppable_accumulator_base<
-// with_cached_result<impl::variance_impl<Sample, MeanFeature> >
-// >
-//{
-// template<typename Args>
-// droppable_accumulator(Args const &args)
-// : droppable_accumulator_base<
-// with_cached_result<impl::variance_impl<Sample, MeanFeature> >
-// >(args)
-// {
-// }
-//};
+//////////////////////////////////////////////////////////////////////////
+// droppable_accumulator<variance_impl>
+// need to specialize droppable lazy variance to cache the result at the
+// point the accumulator is dropped.
+/// INTERNAL ONLY
+///
+template<typename Sample, typename MeanFeature>
+struct droppable_accumulator<impl::variance_impl<Sample, MeanFeature> >
+ : droppable_accumulator_base<
+ with_cached_result<impl::variance_impl<Sample, MeanFeature> >
+ >
+{
+ template<typename Args>
+ droppable_accumulator(Args const &args)
+ : droppable_accumulator::base(args)
+ {
+ }
+};
 
 }} // namespace boost::accumulators
 

Modified: trunk/boost/accumulators/statistics/weighted_variance.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/weighted_variance.hpp (original)
+++ trunk/boost/accumulators/statistics/weighted_variance.hpp 2008-02-19 02:14:37 EST (Tue, 19 Feb 2008)
@@ -158,26 +158,24 @@
     typedef tag::immediate_weighted_variance type;
 };
 
-////////////////////////////////////////////////////////////////////////////
-//// droppable_accumulator<weighted_variance_impl>
-//// need to specialize droppable lazy weighted_variance to cache the result at the
-//// point the accumulator is dropped.
-///// INTERNAL ONLY
-/////
-//template<typename Sample, typename Weight, typename MeanFeature>
-//struct droppable_accumulator<impl::weighted_variance_impl<Sample, Weight, MeanFeature> >
-// : droppable_accumulator_base<
-// with_cached_result<impl::weighted_variance_impl<Sample, Weight, MeanFeature> >
-// >
-//{
-// template<typename Args>
-// droppable_accumulator(Args const &args)
-// : droppable_accumulator_base<
-// with_cached_result<impl::weighted_variance_impl<Sample, Weight, MeanFeature> >
-// >(args)
-// {
-// }
-//};
+//////////////////////////////////////////////////////////////////////////
+// droppable_accumulator<weighted_variance_impl>
+// need to specialize droppable lazy weighted_variance to cache the result at the
+// point the accumulator is dropped.
+/// INTERNAL ONLY
+///
+template<typename Sample, typename Weight, typename MeanFeature>
+struct droppable_accumulator<impl::weighted_variance_impl<Sample, Weight, MeanFeature> >
+ : droppable_accumulator_base<
+ with_cached_result<impl::weighted_variance_impl<Sample, Weight, MeanFeature> >
+ >
+{
+ template<typename Args>
+ droppable_accumulator(Args const &args)
+ : droppable_accumulator::base(args)
+ {
+ }
+};
 
 }} // namespace boost::accumulators
 

Modified: trunk/libs/accumulators/doc/accumulators.qbk
==============================================================================
--- trunk/libs/accumulators/doc/accumulators.qbk (original)
+++ trunk/libs/accumulators/doc/accumulators.qbk 2008-02-19 02:14:37 EST (Tue, 19 Feb 2008)
@@ -614,7 +614,7 @@
     // add more data
     acc(3.0);
     
- // This will display "3" and "1.5"
+ // This will display "6" and "1.5"
     std::cout << sum(acc) << '\n' << mean(acc);
 
 Dropping an accumulator essentially freezes it in its current state. It no longer gets
@@ -636,9 +636,7 @@
     {
         template<typename Args>
         droppable_accumulator(Args const & args)
- : droppable_accumulator_base<
- with_cached_result<impl::mean_accumulator<Sample> >
- >(args)
+ : droppable_accumulator::base(args)
         {
         }
     };


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