...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::indexed_range — Range over histogram bins with multi-dimensional index.
// In header: <boost/histogram/indexed.hpp> template<typename Histogram> class indexed_range { public: // member classes/structs/unions // Pointer-like class to access value and index of current cell. class accessor { public: // member classes/structs/unions // Array-like view into the current multi-dimensional index. class index_view { public: // construct/copy/destruct index_view(const cache_item *, const cache_item *); // public member functions auto begin() const noexcept; auto end() const noexcept; auto size() const noexcept; int operator[](unsigned) const noexcept; int at(unsigned) const; }; // construct/copy/destruct accessor(indexed_range &, value_iterator); // public member functions decltype(auto) operator *() const noexcept; decltype(auto) get() const noexcept; decltype(auto) operator->() const noexcept; int index(unsigned = 0) const noexcept; auto indices() const noexcept; template<unsigned N = 0> decltype(auto) bin(std::integral_constant< unsigned, N > = {}) const; decltype(auto) bin(unsigned) const; double density() const; }; struct cache_item { // public data members int idx; int begin; int end; int extent; }; class range_iterator : public boost::iterator_adaptor< range_iterator, value_iterator, accessor, std::forward_iterator_tag, accessor > { public: // construct/copy/destruct range_iterator(indexed_range *, value_iterator) noexcept; // public member functions accessor operator *() const noexcept; // private member functions void increment() noexcept; }; // construct/copy/destruct indexed_range(Histogram &, coverage); // public member functions range_iterator begin() noexcept; range_iterator end() noexcept; };
indexed_range
public member functionsrange_iterator begin() noexcept;
range_iterator end() noexcept;