...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::collector — Collects samples.
// In header: <boost/histogram/accumulators/collector.hpp> template<typename ContainerType> class collector { public: // types typedef ContainerType container_type; typedef typename container_type::value_type value_type; typedef typename container_type::allocator_type allocator_type; typedef typename container_type::const_reference const_reference; typedef typename container_type::iterator iterator; typedef typename container_type::const_iterator const_iterator; typedef typename container_type::size_type size_type; typedef typename container_type::const_pointer const_pointer; // public member functions template<typename... Args> explicit collector(Args &&...); template<typename T, typename... Args> explicit collector(std::initializer_list< T >, Args &&...); void operator()(const_reference); template<typename C> collector & operator+=(const collector< C > &); template<typename Iterable> bool operator==(const Iterable &) const noexcept; template<typename Iterable> bool operator!=(const Iterable &) const noexcept; size_type size() const noexcept; size_type count() const noexcept; const const_iterator begin() const noexcept; const const_iterator end() const noexcept; const_reference operator[](size_type) const noexcept; const_pointer data() const noexcept; allocator_type get_allocator() const; template<typename Archive> void serialize(Archive &, unsigned); };
Input samples are stored in an internal container for later retrival, which stores the values consecutively in memory. The interface is designed to work with std::vector and other containers which implement the same API.
Warning: The memory of the accumulator is unbounded.
collector
public member functionstemplate<typename... Args> explicit collector(Args &&... args);
template<typename T, typename... Args> explicit collector(std::initializer_list< T > list, Args &&... args);
void operator()(const_reference x);Append sample x.
template<typename C> collector & operator+=(const collector< C > & rhs);Append samples from another collector.
template<typename Iterable> bool operator==(const Iterable & rhs) const noexcept;Return true if collections are equal.
Two collections are equal if they have the same number of elements which all compare equal.
template<typename Iterable> bool operator!=(const Iterable & rhs) const noexcept;Return true if collections are not equal.
size_type size() const noexcept;Return number of samples.
size_type count() const noexcept;Return number of samples (alias for size()).
const const_iterator begin() const noexcept;Return readonly iterator to start of collection.
const const_iterator end() const noexcept;Return readonly iterator to end of collection.
const_reference operator[](size_type idx) const noexcept;Return const reference to value at index.
const_pointer data() const noexcept;Return pointer to internal memory.
allocator_type get_allocator() const;
template<typename Archive> void serialize(Archive & ar, unsigned version);