Boost C++ Libraries 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.

Class template indexed_range

boost::histogram::indexed_range — Input iterator range over histogram bins with multi-dimensional index.


// In header: <boost/histogram/indexed.hpp>

template<typename Histogram> 
class indexed_range {
  // types
  typedef unspecified iterator;       
  typedef unspecified value_iterator; 
  typedef unspecified value_reference;
  typedef unspecified value_type;     

  // member classes/structs/unions

  // Lightweight view to access value and index of current cell.

  class accessor {
    // member classes/structs/unions

    // Array-like view into the current multi-dimensional index.

    class index_view {
      // types
      typedef unspecified              const_iterator; 
      typedef const axis::index_type & const_reference;

      // public member functions
      const_iterator begin() const noexcept;
      const_iterator end() const noexcept;
      std::size_t size() const noexcept;
      const_reference operator[](unsigned) const noexcept;
      const_reference at(unsigned) const;
    // construct/copy/destruct
    accessor(iterator &) noexcept;
    accessor(const accessor &) = default;
    accessor & operator=(const accessor &);
    template<typename T> accessor & operator=(const T &);

    // public member functions
    value_reference get() const noexcept;
    value_reference operator *() const noexcept;
    value_iterator operator->() const noexcept;
    axis::index_type index(unsigned = 0) const noexcept;
    index_view indices() const noexcept;
    template<unsigned N = 0> 
      decltype(auto) bin(std::integral_constant< unsigned, N > = {}) const;
    decltype(auto) bin(unsigned) const;
    double density() const;
    bool operator<(const accessor &) noexcept;
    bool operator>(const accessor &) noexcept;
    bool operator==(const accessor &) noexcept;
    bool operator!=(const accessor &) noexcept;
    bool operator<=(const accessor &) noexcept;
    bool operator>=(const accessor &) noexcept;
    template<typename U> bool operator<(const U &) const noexcept;
    template<typename U> bool operator>(const U &) const noexcept;
    template<typename U> bool operator==(const U &) const noexcept;
    template<typename U> bool operator!=(const U &) const noexcept;
    template<typename U> bool operator<=(const U &) const noexcept;
    template<typename U> bool operator>=(const U &) const noexcept;
    operator value_type() const noexcept;

  // construct/copy/destruct
  indexed_range(histogram_type &, coverage);
  template<typename Iterable> indexed_range(histogram_type &, Iterable &&);

  // public member functions
  iterator begin() noexcept;
  iterator end() noexcept;


The iterator returned by begin() can only be incremented. If several copies of the input iterators exist, the other copies become invalid if one of them is incremented.

indexed_range public construct/copy/destruct

  1. indexed_range(histogram_type & hist, coverage cov);
  2. template<typename Iterable> 
      indexed_range(histogram_type & hist, Iterable && range);

indexed_range public member functions

  1. iterator begin() noexcept;
  2. iterator end() noexcept;