| Home | Libraries | People | FAQ | More

## Class template indexed_range

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

## Synopsis

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

    template<typename Histogram>
    class indexed_range {
    public:
      // 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 {
      public:
        // member classes/structs/unions

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

        class index_view {
        public:
          // 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;
        };

        // public member functions
        accessor & operator=(const accessor &);
        template<typename T> accessor & operator=(const T &);
        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;
      };

      // public member functions
      indexed_range(histogram_type &, coverage);
      template<typename Iterable> indexed_range(histogram_type &, Iterable &&);
      iterator begin() noexcept;
      iterator end() noexcept;
    };

## Description

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 member functions

1.     indexed_range(histogram_type & hist, coverage cov);

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

3.     iterator begin() noexcept;

4.     iterator end() noexcept;