...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 metadata_base_t< MetaData > { public: // public member functions integer() = default; integer(value_type, value_type, metadata_type = {}, options_type = {}); integer(const integer &, index_type, index_type, unsigned); 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 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.
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.
integer
public member functionsinteger() = default;
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: |
|
integer(const integer & src, index_type begin, index_type end, unsigned merge);Constructor used by algorithm::reduce to shrink and rebin.
index_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);
integer
public static functionsstatic constexpr unsigned options() noexcept;Returns the options.
static constexpr bool inclusive() noexcept;Whether the axis is inclusive (see axis::traits::is_inclusive).