diff --git a/include/boost/histogram/axis/integer.hpp b/include/boost/histogram/axis/integer.hpp index 0ca77a7c..940d75c8 100644 --- a/include/boost/histogram/axis/integer.hpp +++ b/include/boost/histogram/axis/integer.hpp @@ -22,29 +22,21 @@ namespace boost { namespace histogram { namespace axis { -/** Axis for an interval of integer values with unit steps. - * - * Binning is a O(1) operation. This axis operates - * faster than a regular axis. - */ -template -class integer : public base, - public iterator_mixin> { + +template +class integer_base : public base, + public iterator_mixin> { static_assert(!test(Options, option::circular) || !test(Options, option::underflow), "circular axis cannot have underflow"); static_assert(!std::is_integral::value || std::is_same::value, "integer axis requires type floating point type or int"); using base_type = base; - -public: using metadata_type = MetaData; using value_type = IntType; - -private: using index_type = std::conditional_t::value, int, double>; public: - integer() = default; + integer_base() = default; /** Construct over semi-open integer interval [start, stop). * @@ -53,13 +45,13 @@ public: * \param metadata description of the axis. * \param options extra bin options. */ - integer(value_type start, value_type stop, metadata_type m = {}) + integer_base(value_type start, value_type stop, metadata_type m = {}) : base_type(static_cast(stop - start > 0 ? stop - start : 0), std::move(m)) , min_(start) {} /// Constructor used by algorithm::reduce to shrink and rebin. - integer(const integer& src, int begin, int end, unsigned merge) + integer_base(const integer_base& src, int begin, int end, unsigned merge) : base_type(end - begin, src.metadata()), min_(src.min_ + begin) { if (merge > 1) BOOST_THROW_EXCEPTION(std::invalid_argument("cannot merge bins for integer axis")); @@ -72,11 +64,6 @@ public: return index_impl(std::is_floating_point(), x); } - template