[Boost-bugs] [Boost C++ Libraries] #5302: [accumulator] Generalise type arithmetics, e.g. make it play well with boost.units.

Subject: [Boost-bugs] [Boost C++ Libraries] #5302: [accumulator] Generalise type arithmetics, e.g. make it play well with boost.units.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-03-14 05:34:47


#5302: [accumulator] Generalise type arithmetics, e.g. make it play well with
boost.units.
--------------------------------------+-------------------------------------
 Reporter: alfredo.correa@… | Owner: eric_niebler
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: accumulator
  Version: Boost 1.45.0 | Severity: Problem
 Keywords: |
--------------------------------------+-------------------------------------
 Accumulators library assumes that for an accumulated type T*T is also of
 type T. This makes it difficult to play it well with boost.unit for
 example; specially for the variance accumulator.

 Based on http://groups.google.com/group/boostusers/msg/86ebe100e3a86794
 Below is the goal code:

 #include<boost/accumulators/accumulators.hpp>
 #include <boost/accumulators/statistics/variance.hpp>
 #include<boost/units/systems/si.hpp>
 #include<boost/units/io.hpp>

 using namespace boost::accumulators;
 using namespace boost::units;
 int main(){
         accumulator_set<
                 quantity<si::time>,
                 features<
                         tag::variance,
>
> a;
         a(1.0*si::second);
         a(2.0*si::second);
         a(3.0*si::second);
         std::cout
                 << extract::variance(a)
         ;
         return 0;
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5302>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC