...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::histogram::accumulators::count — Uses a C++ builtin arithmetic type to accumulate a count.
// In header: <boost/histogram/accumulators/count.hpp> template<typename ValueType> class count { public: // types typedef ValueType value_type; typedef const value_type & const_reference; // construct/copy/destruct count() = default; count(const_reference) noexcept; template<typename T> count(const count< T > &) noexcept; // public member functions count & operator++() noexcept; count & operator+=(const_reference) noexcept; count & operator+=(const count &) noexcept; count & operator *=(const_reference) noexcept; bool operator==(const count &) const noexcept; bool operator!=(const count &) const noexcept; const_reference value() const noexcept; explicit operator value_type() const noexcept; template<typename Archive> void serialize(Archive &, unsigned); count & operator *=(const count &) noexcept; count operator *(const count &) const noexcept; count & operator/=(const count &) noexcept; count operator/(const count &) const noexcept; bool operator<(const count &) const noexcept; bool operator>(const count &) const noexcept; bool operator<=(const count &) const noexcept; bool operator>=(const count &) const noexcept; };
This wrapper class may be used as a base class by users who want to add custom metadata to each bin of a histogram. Otherwise, arithmetic types should be used directly as accumulators in storages for simplicity. In other words, prefer dense_storage<double>
overdense_storage<count<double>>
, both are functionally equivalent.
When weighted data is accumulated and high precision is required, use accumulators::sum
instead. If a local variance estimate for the weight distribution should be computed as well (generally needed for a detailed statistical analysis), useaccumulators::weighted_sum
.
count
public
construct/copy/destructcount() = default;
count(const_reference value) noexcept;Initialize count to value and allow implicit conversion.
template<typename T> count(const count< T > & c) noexcept;Allow implicit conversion from other count.
count
public member functionscount & operator++() noexcept;Increment count by one.
count & operator+=(const_reference value) noexcept;Increment count by value.
count & operator+=(const count & s) noexcept;Add another count.
count & operator *=(const_reference value) noexcept;Scale by value.
bool operator==(const count & rhs) const noexcept;
bool operator!=(const count & rhs) const noexcept;
const_reference value() const noexcept;Return count.
explicit operator value_type() const noexcept;
template<typename Archive> void serialize(Archive & ar, unsigned);
count & operator *=(const count & rhs) noexcept;
count operator *(const count & rhs) const noexcept;
count & operator/=(const count & rhs) noexcept;
count operator/(const count & rhs) const noexcept;
bool operator<(const count & rhs) const noexcept;
bool operator>(const count & rhs) const noexcept;
bool operator<=(const count & rhs) const noexcept;
bool operator>=(const count & rhs) const noexcept;