Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class accessor

boost::histogram::indexed_range::accessor — Pointer-like class to access value and index of current cell.

Synopsis

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



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

Description

Its methods allow one to query the current indices and bins. Furthermore, it acts like a pointer to the cell value.

accessor public construct/copy/destruct

  1. accessor(indexed_range & p, value_iterator i);

accessor public member functions

  1. decltype(auto) operator *() const noexcept;
    Returns the cell value.
  2. decltype(auto) get() const noexcept;
    Returns the cell value.
  3. decltype(auto) operator->() const noexcept;
    Access fields and methods of the cell object.
  4. int index(unsigned d = 0) const noexcept;
    Access current index.

    Parameters:

    d

    axis dimension.

  5. auto indices() const noexcept;
    Access indices as an iterable range.
  6. template<unsigned N = 0> 
      decltype(auto) bin(std::integral_constant< unsigned, N > = {}) const;
    Access current bin.

    Template Parameters:

    N

    axis dimension.

  7. decltype(auto) bin(unsigned d) const;
    Access current bin.

    Parameters:

    d

    axis dimension.

  8. double density() const;
    Computes density in current cell.

    The density is computed as the cell value divided by the product of bin widths. Axes without bin widths, like axis::category, are treated as having unit bin with.


PrevUpHomeNext