From f2b51bcb11a1f35414324a2b1ef42fc96422283e Mon Sep 17 00:00:00 2001 From: Hans Dembinski Date: Thu, 14 Apr 2016 23:37:40 -0400 Subject: [PATCH] simplification --- include/boost/histogram/axis.hpp | 2 ++ include/boost/histogram/basic_histogram.hpp | 7 ++----- include/boost/histogram/visitors.hpp | 4 ---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/boost/histogram/axis.hpp b/include/boost/histogram/axis.hpp index fb5db77a..585124b8 100644 --- a/include/boost/histogram/axis.hpp +++ b/include/boost/histogram/axis.hpp @@ -197,6 +197,8 @@ public: const std::string& operator[](int idx) const { return categories_[idx]; } + inline bool uoflow() const { return false; } + bool operator==(const category_axis&) const; private: std::vector categories_; diff --git a/include/boost/histogram/basic_histogram.hpp b/include/boost/histogram/basic_histogram.hpp index c2d2d305..a58aca95 100644 --- a/include/boost/histogram/basic_histogram.hpp +++ b/include/boost/histogram/basic_histogram.hpp @@ -30,6 +30,8 @@ public: ~basic_histogram() {} unsigned dim() const { return axes_.size(); } + unsigned bins(unsigned i) const { return size_[i]; } + unsigned shape(unsigned i) const { return size_[i] + 2 * uoflow_[i]; } template T& axis(unsigned i) @@ -41,9 +43,6 @@ public: { if (is_same::value) return axes_[i]; return boost::get(axes_[i]); } - unsigned bins(unsigned i) const { return size_[i]; } - unsigned shape(unsigned i) const { return size_[i] + 2 * uoflow_[i]; } - protected: basic_histogram() {} explicit basic_histogram(const axes_type& axes); @@ -61,8 +60,6 @@ protected: BOOST_PP_REPEAT_FROM_TO(1, BOOST_HISTOGRAM_AXIS_LIMIT, BOOST_HISTOGRAM_BASE_CTOR, nil) bool operator==(const basic_histogram&) const; - bool operator!=(const basic_histogram& o) const - { return !operator==(o); } template inline diff --git a/include/boost/histogram/visitors.hpp b/include/boost/histogram/visitors.hpp index c249c0cc..dc87b02f 100644 --- a/include/boost/histogram/visitors.hpp +++ b/include/boost/histogram/visitors.hpp @@ -16,16 +16,12 @@ namespace detail { struct fields_visitor : public static_visitor { - unsigned operator()(const category_axis& a) const { return a.bins(); } - template unsigned operator()(const A& a) const { return a.bins() + 2 * a.uoflow(); } }; struct uoflow_visitor : public static_visitor { - bool operator()(const category_axis& a) const { return false; } - template bool operator()(const A& a) const { return a.uoflow(); } };