diff --git a/include/boost/histogram/detail/meta.hpp b/include/boost/histogram/detail/meta.hpp index e9fd17e0..ac5ee845 100644 --- a/include/boost/histogram/detail/meta.hpp +++ b/include/boost/histogram/detail/meta.hpp @@ -19,15 +19,6 @@ namespace boost { namespace histogram { namespace detail { -template struct supports_weights { - template static std::false_type test(...); - - template - static decltype(std::declval().weighted_increase(0, 0.0), std::true_type{}) test(int); - - static bool const value = decltype(test(0))::value; -}; - template ().size(), std::declval().increase(0), std::declval().value(0))> diff --git a/include/boost/histogram/detail/utility.hpp b/include/boost/histogram/detail/utility.hpp index fa215a81..ea31f1d2 100644 --- a/include/boost/histogram/detail/utility.hpp +++ b/include/boost/histogram/detail/utility.hpp @@ -7,10 +7,10 @@ #ifndef _BOOST_HISTOGRAM_DETAIL_UTILITY_HPP_ #define _BOOST_HISTOGRAM_DETAIL_UTILITY_HPP_ -#include -#include #include +#include #include +#include namespace boost { namespace histogram { @@ -62,13 +62,12 @@ template struct xlin { struct index_mapper { std::size_t first, second; - index_mapper(std::vector && nvec, std::vector && bvec) : - first(0), second(0) - { + index_mapper(std::vector &&nvec, std::vector &&bvec) + : first(0), second(0) { dims.reserve(nvec.size()); std::size_t s1 = 1, s2 = 1; auto bi = bvec.begin(); - for (const auto& ni : nvec) { + for (const auto &ni : nvec) { if (*bi) { dims.push_back({s1, s2}); s2 *= ni; @@ -78,12 +77,11 @@ struct index_mapper { s1 *= ni; ++bi; } - std::sort(dims.begin(), dims.end(), - [](const dim& a, const dim& b) { - if (a.stride1 == b.stride1) - return 0; - return a.stride1 < b.stride1 ? -1 : 1; - }); + std::sort(dims.begin(), dims.end(), [](const dim &a, const dim &b) { + if (a.stride1 == b.stride1) + return 0; + return a.stride1 < b.stride1 ? -1 : 1; + }); nfirst = s1; } @@ -91,18 +89,19 @@ struct index_mapper { ++first; second = 0; auto f = first; - for (const auto& d : dims) { + for (const auto &d : dims) { auto i = f / d.stride1; f -= i * d.stride1; second += i * d.stride2; } - assert(f == 0); return first < nfirst; } private: std::size_t nfirst; - struct dim { std::size_t stride1, stride2; }; + struct dim { + std::size_t stride1, stride2; + }; std::vector dims; }; diff --git a/include/boost/histogram/histogram_fwd.hpp b/include/boost/histogram/histogram_fwd.hpp index 89f79c1c..f3300f41 100644 --- a/include/boost/histogram/histogram_fwd.hpp +++ b/include/boost/histogram/histogram_fwd.hpp @@ -8,8 +8,8 @@ #define _BOOST_HISTOGRAM_HISTOGRAM_FWD_HPP_ #include -#include #include +#include namespace boost { namespace histogram { @@ -24,6 +24,7 @@ class weight { public: explicit weight(double v) : value(v) {} explicit operator double() const { return value; } + private: double value; }; @@ -32,14 +33,15 @@ class count { public: explicit count(unsigned v) : value(v) {} explicit operator unsigned() const { return value; } + private: unsigned value; }; namespace detail { -template -struct keep_remove : std::set { - keep_remove(const std::initializer_list& l) : std::set(l) {} +template struct keep_remove : std::set { + keep_remove(const std::initializer_list &l) + : std::set(l) {} }; } // namespace detail diff --git a/include/boost/histogram/histogram_impl_dynamic.hpp b/include/boost/histogram/histogram_impl_dynamic.hpp index 6f8253ae..5f0eb141 100644 --- a/include/boost/histogram/histogram_impl_dynamic.hpp +++ b/include/boost/histogram/histogram_impl_dynamic.hpp @@ -15,9 +15,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -129,9 +129,11 @@ public: template void fill(Args... args) noexcept { using n_count = typename mpl::count, count>; using n_weight = typename mpl::count, weight>; - static_assert((n_count::value + n_weight::value) <= 1, - "arguments may contain at most one instance of type count or weight"); - BOOST_ASSERT_MSG(sizeof...(args) == (dim() + n_count::value + n_weight::value), + static_assert( + (n_count::value + n_weight::value) <= 1, + "arguments may contain at most one instance of type count or weight"); + BOOST_ASSERT_MSG(sizeof...(args) == + (dim() + n_count::value + n_weight::value), "number of arguments does not match histogram dimension"); fill_impl(mpl::int_<(n_count::value + 2 * n_weight::value)>(), args...); } @@ -311,9 +313,10 @@ private: template