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

Class template collector
PrevUpHomeNext

Class template collector

boost::histogram::accumulators::collector — Collects samples.

Synopsis

// 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);
};

Description

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 functions

  1. template<typename... Args> explicit collector(Args &&... args);
  2. template<typename T, typename... Args> 
      explicit collector(std::initializer_list< T > list, Args &&... args);
  3. void operator()(const_reference x);
    Append sample x.
  4. template<typename C> collector & operator+=(const collector< C > & rhs);
    Append samples from another collector.
  5. 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.

  6. template<typename Iterable> 
      bool operator!=(const Iterable & rhs) const noexcept;
    Return true if collections are not equal.
  7. size_type size() const noexcept;
    Return number of samples.
  8. size_type count() const noexcept;
    Return number of samples (alias for size()).
  9. const const_iterator begin() const noexcept;
    Return readonly iterator to start of collection.
  10. const const_iterator end() const noexcept;
    Return readonly iterator to end of collection.
  11. const_reference operator[](size_type idx) const noexcept;
    Return const reference to value at index.
  12. const_pointer data() const noexcept;
    Return pointer to internal memory.
  13. allocator_type get_allocator() const;
  14. template<typename Archive> void serialize(Archive & ar, unsigned version);

PrevUpHomeNext