...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::histogram::axis::integer — Axis for an interval of integer values with unit steps.
// 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 boost::histogram::axis::metadata_base< MetaData > { public: // construct/copy/destruct integer() = default; integer(value_type, value_type, metadata_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; };
Binning is a O(1) operation. This axis bins faster than a regular axis.
typename Value
input value type. Must be integer or floating point.
typename MetaData
type to store meta data.
typename Options
see boost::histogram::axis::option (all values allowed).
integer
public
construct/copy/destructinteger() = default;
integer(value_type start, value_type stop, metadata_type meta = {});Construct over semi-open integer interval [start, stop).
Parameters: |
|
integer(const integer & src, index_type begin, index_type end, unsigned merge);Constructor used by algorithm::reduce to shrink and rebin.
integer
public member functionsindex_type index(value_type x) const noexcept;Return index for value argument.
auto update(value_type x) noexcept;Returns index and shift (if axis has grown) for the passed argument.
value_type value(local_index_type i) const noexcept;Return value for index argument.
decltype(auto) bin(index_type idx) const noexcept;Return bin for index argument.
index_type size() const noexcept;Returns the number of bins, without over- or underflow.
template<typename V, typename M, typename O> bool operator==(const integer< V, M, O > & o) const noexcept;
template<typename V, typename M, typename O> bool operator!=(const integer< V, M, O > & o) const noexcept;
template<typename Archive> void serialize(Archive & ar, unsigned);