Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class template weighted_sum

boost::histogram::accumulators::weighted_sum — Holds sum of weights and its variance estimate.

Synopsis

// In header: <boost/histogram/accumulators/weighted_sum.hpp>

template<typename RealType> 
class weighted_sum {
public:
  // construct/copy/destruct
  weighted_sum() = default;
  explicit weighted_sum(const RealType &) noexcept;
  weighted_sum(const RealType &, const RealType &) noexcept;

  // public member functions
  weighted_sum & operator++();
  template<typename T> weighted_sum & operator+=(const T &);
  template<typename T> weighted_sum & operator+=(const weighted_sum< T > &);
  weighted_sum & operator *=(const RealType &);
  bool operator==(const RealType &) const noexcept;
  template<typename T> 
    bool operator==(const weighted_sum< T > &) const noexcept;
  template<typename T> bool operator!=(const T &) const noexcept;
  const RealType & value() const noexcept;
  const RealType & variance() const noexcept;
  template<typename T> explicit operator T() const;
  template<typename Archive> void serialize(Archive &, unsigned);
};

Description

weighted_sum public construct/copy/destruct

  1. weighted_sum() = default;
  2. explicit weighted_sum(const RealType & value) noexcept;
  3. weighted_sum(const RealType & value, const RealType & variance) noexcept;

weighted_sum public member functions

  1. weighted_sum & operator++();
    Increment by one.
  2. template<typename T> weighted_sum & operator+=(const T & value);
    Increment by value.
  3. template<typename T> weighted_sum & operator+=(const weighted_sum< T > & rhs);
    Added another weighted sum.
  4. weighted_sum & operator *=(const RealType & x);
    Scale by value.
  5. bool operator==(const RealType & rhs) const noexcept;
  6. template<typename T> 
      bool operator==(const weighted_sum< T > & rhs) const noexcept;
  7. template<typename T> bool operator!=(const T & rhs) const noexcept;
  8. const RealType & value() const noexcept;
    Return value of the sum.
  9. const RealType & variance() const noexcept;
    Return estimated variance of the sum.
  10. template<typename T> explicit operator T() const;
  11. template<typename Archive> void serialize(Archive &, unsigned);

PrevUpHomeNext