Changeset 887


Ignore:
Timestamp:
Sep 24, 2007, 9:52:03 PM (14 years ago)
Author:
Peter
Message:

made add function template so it accepts AveragerWeighted? too. Also added some tests #refs 246

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/averager_test.cc

    r865 r887  
    3434#include <limits>
    3535#include <iostream>
     36#include <set>
    3637
    3738using namespace theplu::yat::statistics;
     
    122123    *error << "variance(mean) " << a.variance(a.mean()) << std::endl;
    123124  }
     125  theplu::yat::utility::vector* tmp_vec = new theplu::yat::utility::vector(10);
     126  add(a, tmp_vec->begin(), tmp_vec->end());
     127  delete tmp_vec;
     128  std::set<double>* tmp_set = new std::set<double>;
     129  tmp_set->insert(1.0);
     130  tmp_set->insert(2.0);
     131  add(a, tmp_set->begin(), tmp_set->end());
     132  delete tmp_set;
     133
    124134
    125135  // Testing AveragerWeighted
     
    163173  }
    164174  delete aw2;
     175  {
     176    theplu::yat::utility::vector tmp(10);
     177    add(aw, tmp.begin(), tmp.end());
     178  }
     179  {
     180    std::set<double> tmp;
     181    tmp.insert(1.0);
     182    tmp.insert(2.0);
     183    add(aw, tmp.begin(), tmp.end());
     184  }
    165185 
    166186
  • trunk/yat/statistics/Averager.h

    r886 r887  
    195195     \brief adding a ranges of values to Averager \a a
    196196   */
    197   template <class Iter>
    198   void add(Averager& a, Iter first, Iter last)
     197  template <class Aver, typename Iter>
     198  void add(Aver& a, Iter first, Iter last)
    199199  {
    200200    for ( ; first != last; ++first)
Note: See TracChangeset for help on using the changeset viewer.