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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class template regular

boost::histogram::axis::regular — Axis for equidistant intervals on the real line.

Synopsis

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

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

  // public member functions
  const transform_type & transform() const noexcept;
  index_type index(value_type) const noexcept;
  std::pair< index_type, index_type > update(value_type) noexcept;
  value_type value(real_index_type) const noexcept;
  decltype(auto) bin(index_type) const noexcept;
  index_type size() const noexcept;
  template<typename V, typename T, typename M, typename O> 
    bool operator==(const regular< V, T, M, O > &) const noexcept;
  template<typename V, typename T, typename M, typename O> 
    bool operator!=(const regular< V, T, M, O > &) const noexcept;
  template<typename Archive> void serialize(Archive &, unsigned);

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

Description

The most common binning strategy. Very fast. Binning is a O(1) operation.

Template Parameters

  1. typename Value

    input value type, must be floating point.

  2. typename Transform

    builtin or user-defined transform type.

  3. typename MetaData

    type to store meta data.

  4. typename Options

    see boost::histogram::axis::option (all values allowed).

regular public construct/copy/destruct

  1. regular() = default;
  2. regular(transform_type trans, unsigned n, value_type start, value_type stop, 
            metadata_type meta = {});
    Construct n bins over real transformed range [start, stop).

    Parameters:

    meta

    description of the axis (optional).

    n

    number of bins.

    start

    low edge of first bin.

    stop

    high edge of last bin.

    trans

    transform instance to use.

  3. regular(unsigned n, value_type start, value_type stop, 
            metadata_type meta = {});
    Construct n bins over real range [start, stop).

    Parameters:

    meta

    description of the axis (optional).

    n

    number of bins.

    start

    low edge of first bin.

    stop

    high edge of last bin.

  4. template<typename T> 
      regular(transform_type trans, step_type< T > step, value_type start, 
              value_type stop, metadata_type meta = {});
    Construct bins with the given step size over real transformed range [start, stop).

    The axis computes the number of bins as n = abs(stop - start) / step, rounded down. This means that stop is an upper limit to the actual value (start + n * step).

    Parameters:

    meta

    description of the axis (optional).

    start

    low edge of first bin.

    step

    width of a single bin.

    stop

    upper limit of high edge of last bin (see below).

    trans

    transform instance to use.

  5. template<typename T> 
      regular(step_type< T > step, value_type start, value_type stop, 
              metadata_type meta = {});
    Construct bins with the given step size over real range [start, stop).

    The axis computes the number of bins as n = abs(stop - start) / step, rounded down. This means that stop is an upper limit to the actual value (start + n * step).

    Parameters:

    meta

    description of the axis (optional).

    start

    low edge of first bin.

    step

    width of a single bin.

    stop

    upper limit of high edge of last bin (see below).

  6. regular(const regular & src, index_type begin, index_type end, unsigned merge);
    Constructor used by algorithm::reduce to shrink and rebin (not for users).

regular public member functions

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

regular public static functions

  1. static constexpr unsigned options() noexcept;
    Returns the options.

PrevUpHomeNext