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

PrevUpHomeNext

Class template integer

boost::histogram::axis::integer — Axis for an interval of integer values with unit steps.

Synopsis

// In header: <boost/histogram/axis/integer.hpp>

template<typename Value, typename MetaData, typename Options> 
class integer : public boost::histogram::axis::iterator_mixin< integer< Value, MetaData, Options > >,
                public metadata_base_t< MetaData >
{
public:
  // construct/copy/destruct
  integer() = default;
  integer(value_type, value_type, metadata_type = {}, options_type = {});
  integer(const integer &, index_type, index_type, unsigned);

  // public member functions
  index_type index(value_type) const noexcept;
  auto update(value_type) noexcept;
  value_type value(local_index_type) const noexcept;
  decltype(auto) bin(index_type) const noexcept;
  index_type size() const noexcept;
  template<typename V, typename M, typename O> 
    bool operator==(const integer< V, M, O > &) const noexcept;
  template<typename V, typename M, typename O> 
    bool operator!=(const integer< V, M, O > &) const noexcept;
  template<typename Archive> void serialize(Archive &, unsigned);

  // public static functions
  static constexpr unsigned options() noexcept;
  static constexpr bool inclusive() noexcept;
};

Description

Binning is a O(1) operation. This axis bins even faster than a regular axis.

The options growth andcircular are mutually exclusive. If the axis uses integers and eithergrowth orcircular are set, the axis cannot have the optionsunderflow oroverflow set.

Template Parameters

  1. typename Value

    input value type. Must be integer or floating point.

  2. typename MetaData

    type to store meta data.

  3. typename Options

    see boost::histogram::axis::option.

integer public construct/copy/destruct

  1. integer() = default;
  2. integer(value_type start, value_type stop, metadata_type meta = {}, 
            options_type options = {});
    Construct over semi-open integer interval [start, stop).

    The constructor throws std::invalid_argument if start is not less than stop.

    The arguments meta and alloc are passed by value. If you move either of them into the axis and the constructor throws, their values are lost. Do not move if you cannot guarantee that the bin description is not valid.

    Parameters:

    meta

    description of the axis (optional).

    options

    see boost::histogram::axis::option (optional).

    start

    first integer of covered range.

    stop

    one past last integer of covered range.

  3. integer(const integer & src, index_type begin, index_type end, unsigned merge);
    Constructor used by algorithm::reduce to shrink and rebin.

integer public member functions

  1. index_type index(value_type x) const noexcept;
    Return index for value argument.
  2. auto update(value_type x) noexcept;
    Returns index and shift (if axis has grown) for the passed argument.
  3. value_type value(local_index_type i) const noexcept;
    Return value for index argument.
  4. decltype(auto) bin(index_type idx) const noexcept;
    Return bin for index argument.
  5. index_type size() const noexcept;
    Returns the number of bins, without over- or underflow.
  6. template<typename V, typename M, typename O> 
      bool operator==(const integer< V, M, O > & o) const noexcept;
  7. template<typename V, typename M, typename O> 
      bool operator!=(const integer< V, M, O > & o) const noexcept;
  8. template<typename Archive> void serialize(Archive & ar, unsigned);

integer public static functions

  1. static constexpr unsigned options() noexcept;
    Returns the options.
  2. static constexpr bool inclusive() noexcept;
    Whether the axis is inclusive (see axis::traits::is_inclusive).

PrevUpHomeNext