From 3b31bf51df52797aad33fcfab5fa294361b2ccde Mon Sep 17 00:00:00 2001 From: Hans Dembinski Date: Tue, 28 Mar 2017 23:27:22 +0200 Subject: [PATCH] clang-format --- include/boost/histogram/detail/meta.hpp | 3 +- include/boost/histogram/detail/utility.hpp | 5 +- include/boost/histogram/histogram.hpp | 2 +- .../histogram/histogram_dynamic_impl.hpp | 82 +++++++++---------- include/boost/histogram/histogram_fwd.hpp | 7 +- .../histogram/histogram_ostream_operators.hpp | 3 +- .../boost/histogram/histogram_static_impl.hpp | 48 ++++++----- .../histogram/storage/container_storage.hpp | 3 +- test/adaptive_storage_test.cpp | 4 +- test/container_storage_test.cpp | 2 +- test/dynamic_histogram_test.cpp | 60 +++++++------- test/static_histogram_test.cpp | 11 +-- 12 files changed, 114 insertions(+), 116 deletions(-) diff --git a/include/boost/histogram/detail/meta.hpp b/include/boost/histogram/detail/meta.hpp index 33892cb3..b2427f7c 100644 --- a/include/boost/histogram/detail/meta.hpp +++ b/include/boost/histogram/detail/meta.hpp @@ -23,8 +23,7 @@ template struct has_variance { template static std::false_type test(...); template - static decltype(std::declval().variance(0), std::true_type{}) - test(int); + static decltype(std::declval().variance(0), std::true_type{}) test(int); static bool const value = decltype(test(0))::value; }; diff --git a/include/boost/histogram/detail/utility.hpp b/include/boost/histogram/detail/utility.hpp index c56f6611..09987842 100644 --- a/include/boost/histogram/detail/utility.hpp +++ b/include/boost/histogram/detail/utility.hpp @@ -27,7 +27,8 @@ inline void escape(std::ostream &os, const String &s) { } template struct lin { - static inline void apply(std::size_t &out, std::size_t &stride, const A &a, int j) { + static inline void apply(std::size_t &out, std::size_t &stride, const A &a, + int j) { // the following is highly optimized code that runs in a hot loop; // please measure the performance impact of changes const int uoflow = a.uoflow(); @@ -43,7 +44,7 @@ template struct lin { template struct xlin { static inline void apply(std::size_t &out, std::size_t &stride, const A &a, - const T &x) { + const T &x) { // the following is highly optimized code that runs in a hot loop; // please measure the performance impact of changes int j = a.index(x); diff --git a/include/boost/histogram/histogram.hpp b/include/boost/histogram/histogram.hpp index 7c73269f..9518bbda 100644 --- a/include/boost/histogram/histogram.hpp +++ b/include/boost/histogram/histogram.hpp @@ -8,7 +8,7 @@ #define _BOOST_HISTOGRAM_HISTOGRAM_HPP_ #include -#include #include +#include #endif diff --git a/include/boost/histogram/histogram_dynamic_impl.hpp b/include/boost/histogram/histogram_dynamic_impl.hpp index 7605b7c6..36c15e88 100644 --- a/include/boost/histogram/histogram_dynamic_impl.hpp +++ b/include/boost/histogram/histogram_dynamic_impl.hpp @@ -10,11 +10,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -31,6 +31,7 @@ template class histogram { static_assert(!mpl::empty::value, "at least one axis required"); using size_pair = std::pair; + public: using axis_type = typename make_variant_over::type; using value_type = typename Storage::value_type; @@ -42,8 +43,7 @@ public: histogram() = default; template - explicit histogram(const Axes1 &... axes) - : axes_({axis_type(axes)...}) { + explicit histogram(const Axes1 &... axes) : axes_({axis_type(axes)...}) { storage_ = Storage(field_count()); } @@ -54,19 +54,17 @@ public: storage_ = Storage(field_count()); } - template - explicit histogram( - const histogram &other) + template + explicit histogram(const histogram &other) : axes_(other.axes_.begin(), other.axes_.end()), storage_(other.storage_) {} - template - explicit histogram(histogram &&other) + template + explicit histogram(histogram &&other) : axes_(std::move(other.axes_)), storage_(std::move(other.storage_)) {} - template - histogram & - operator=(const histogram &other) { + template + histogram &operator=(const histogram &other) { if (static_cast(this) != static_cast(&other)) { axes_ = other.axes_; storage_ = other.storage_; @@ -74,9 +72,8 @@ public: return *this; } - template - histogram & - operator=(histogram &&other) { + template + histogram &operator=(histogram &&other) { if (static_cast(this) != static_cast(&other)) { axes_ = std::move(other.axes_); storage_ = std::move(other.storage_); @@ -84,11 +81,10 @@ public: return *this; } - template - bool - operator==(const histogram &other) const { + template + bool operator==(const histogram &other) const { if (mpl::empty< - typename detail::intersection::type>::value) { + typename detail::intersection::type>::value) { return false; } if (dim() != other.dim()) { @@ -104,11 +100,9 @@ public: } template - histogram & - operator+=(const histogram &other) { + histogram &operator+=(const histogram &other) { static_assert( - !mpl::empty< - typename detail::intersection::type>::value, + !mpl::empty::type>::value, "histograms lack common axes types"); if (dim() != other.dim()) { throw std::logic_error("dimensions of histograms differ"); @@ -126,7 +120,8 @@ public: template void fill(Values... values) { BOOST_ASSERT_MSG(sizeof...(values) == dim(), "number of arguments does not match histogram dimension"); - const auto p = apply_lin(size_pair(0, 1), values...); + const auto p = + apply_lin(size_pair(0, 1), values...); if (p.second) { storage_.increase(p.first); } @@ -142,11 +137,11 @@ public: } } - template - void wfill(value_type w, Values... values) { + template void wfill(value_type w, Values... values) { BOOST_ASSERT_MSG(sizeof...(values) == dim(), "number of arguments does not match histogram dimension"); - const auto p = apply_lin(size_pair(0, 1), values...); + const auto p = + apply_lin(size_pair(0, 1), values...); if (p.second) { storage_.increase(p.first, w); } @@ -165,7 +160,8 @@ public: template value_type value(Indices... indices) const { BOOST_ASSERT_MSG(sizeof...(indices) == dim(), "number of arguments does not match histogram dimension"); - const auto p = apply_lin(size_pair(0, 1), indices...); + const auto p = + apply_lin(size_pair(0, 1), indices...); if (p.second == 0) { throw std::out_of_range("invalid index"); } @@ -184,10 +180,12 @@ public: } template value_type variance(Indices... indices) const { - static_assert(detail::has_variance::value, "Storage lacks variance support"); + static_assert(detail::has_variance::value, + "Storage lacks variance support"); BOOST_ASSERT_MSG(sizeof...(indices) == dim(), "number of arguments does not match histogram dimension"); - const auto p = apply_lin(size_pair(0, 1), indices...); + const auto p = + apply_lin(size_pair(0, 1), indices...); if (p.second == 0) { throw std::out_of_range("invalid index"); } @@ -196,7 +194,8 @@ public: template > value_type variance(Iterator begin, Iterator end) const { - static_assert(detail::has_variance::value, "Storage lacks variance support"); + static_assert(detail::has_variance::value, + "Storage lacks variance support"); BOOST_ASSERT_MSG(std::distance(begin, end) == dim(), "number of arguments does not match histogram dimension"); const auto p = apply_lin_iter(size_pair(0, 1), begin); @@ -252,8 +251,8 @@ private: return fc.value; } - template - bool axes_equal_to(const OtherAxes &other_axes) const { + template + bool axes_equal_to(const A &other_axes) const { detail::cmp_axis ca; for (unsigned i = 0; i < dim(); ++i) { if (!apply_visitor(ca, axes_[i], other_axes[i])) { @@ -267,8 +266,7 @@ private: struct lin_visitor : public static_visitor { mutable size_pair pa; const Value &val; - lin_visitor(const size_pair& p, const Value &v) - : pa(p), val(v) {} + lin_visitor(const size_pair &p, const Value &v) : pa(p), val(v) {} template size_pair operator()(const A &a) const { Lin::apply(pa.first, pa.second, a, val); return pa; @@ -276,18 +274,20 @@ private: }; template