Ignore:
Timestamp:
May 15, 2008, 12:44:30 AM (13 years ago)
Author:
Peter
Message:

adding a similar AveragerPair? traits and using it in PearsonDistance? to simplify the code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/averager_traits.h

    r1305 r1306  
    2525*/
    2626
    27 #include "yat/utility/iterator_traits.h"
    2827#include "Averager.h"
    2928#include "AveragerWeighted.h"
     29#include "AveragerPair.h"
     30#include "AveragerPairWeighted.h"
     31#include "yat/utility/iterator_traits.h"
    3032
    3133namespace theplu {
     
    4951  */
    5052    typedef Averager type;
     53    typedef AveragerPair pair_type;
    5154  };
    5255
     
    6164  */
    6265    typedef AveragerWeighted type;
     66    typedef AveragerPairWeighted pair_type;
    6367  };
    6468
    6569  /**
    66       Convenience wrapper around averager_t
    67       \see averager_t
     70      Convenience wrapper around averager_traits
    6871      \see weighted_iterator_traits                                         \
    6972  */
     
    7982  };
    8083
     84  /**
     85      Convenience wrapper around averager_traits
     86      \see weighted_iterator_traits                                         \
     87  */
     88  template <typename Iterator1, typename Iterator2>
     89  struct averager_pair
     90  {
     91  /**
     92      Convenience Metafunction taking iterator as argument and return
     93      either Averager (if both iterators are unweighted) or AveragerWeighted
     94      otherwise.
     95  */
     96    typedef typename
     97      averager_traits<
     98        typename utility::weighted_if_any2<Iterator1, Iterator2>::type
     99      >::pair_type type;
     100  };
     101
    81102}}} // of namespace statistics, yat, and theplu
    82103
Note: See TracChangeset for help on using the changeset viewer.