Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions include/boost/histogram/detail/accumulator_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,25 @@ struct accumulator_traits_holder {
// member function pointer with weight_type as first argument is better match
template <class R, class T, class U, class... Ts>
accumulator_traits_holder<true, std::remove_cv_t<std::remove_reference_t<Ts>>...>
accumulator_traits_impl_call_op(
R (T::*)(boost::histogram::weight_type<U>, Ts...));
accumulator_traits_impl_call_op(R (T::*)(boost::histogram::weight_type<U>, Ts...));

template <class R, class T, class U, class... Ts>
accumulator_traits_holder<true, std::remove_cv_t<std::remove_reference_t<Ts>>...>
accumulator_traits_impl_call_op(
R (T::*)(boost::histogram::weight_type<U>&, Ts...));
accumulator_traits_impl_call_op(R (T::*)(boost::histogram::weight_type<U>&, Ts...));

template <class R, class T, class U, class... Ts>
accumulator_traits_holder<true, std::remove_cv_t<std::remove_reference_t<Ts>>...>
accumulator_traits_impl_call_op(
R (T::*)(boost::histogram::weight_type<U>&&, Ts...));
accumulator_traits_impl_call_op(R (T::*)(boost::histogram::weight_type<U>&&, Ts...));

template <class R, class T, class U, class... Ts>
accumulator_traits_holder<true, std::remove_cv_t<std::remove_reference_t<Ts>>...>
accumulator_traits_impl_call_op(
R (T::*)(const boost::histogram::weight_type<U>&, Ts...));
accumulator_traits_impl_call_op(R (T::*)(const boost::histogram::weight_type<U>&,
Ts...));

// member function pointer only considered if all specializations above fail
template <class R, class T, class... Ts>
accumulator_traits_holder<false, std::remove_cv_t<std::remove_reference_t<Ts>>...>
accumulator_traits_impl_call_op(R (T::*)(Ts...));
accumulator_traits_impl_call_op(R (T::*)(Ts...));

template <class T>
auto accumulator_traits_impl(T&, priority<2>)
Expand Down
15 changes: 8 additions & 7 deletions include/boost/histogram/detail/fill_n.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,20 @@ struct index_visitor {

template <class T>
void operator()(const T& iterable_or_value) const {
dispatch_on_value_or_iterable(mp11::mp_bool<(std::is_convertible<T, value_type>::value ||
!is_iterable<T>::value)>{},
iterable_or_value);
dispatch_on_value_or_iterable(
mp11::mp_bool<(std::is_convertible<T, value_type>::value ||
!is_iterable<T>::value)>{},
iterable_or_value);
}

template <class T>
void dispatch_on_value_or_iterable(std::false_type, const T& iterable) const {
// T is iterable; fill N values
const auto* tp = dtl::data(iterable) + start_;
for (auto it = begin_; it != begin_ + size_; ++it) linearize_element(IsGrowing{}, it, *tp++);
}

for (auto it = begin_; it != begin_ + size_; ++it)
linearize_element(IsGrowing{}, it, *tp++);
}

template <class T>
void linearize_element(std::true_type, pointer it, const T& x) const {
// must use this code for all axes if one of them is growing
Expand Down Expand Up @@ -154,7 +156,6 @@ struct index_visitor {
// no axis is growing
linearize(idx, stride_, axis_, try_cast<value_type, std::invalid_argument>(value));
}

};

template <class Index, class S, class Axes, class T>
Expand Down
2 changes: 1 addition & 1 deletion test/algorithm_project_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <boost/histogram/algorithm/project.hpp>
#include <boost/histogram/algorithm/sum.hpp>
#include <boost/histogram/axis/integer.hpp>
#include <boost/histogram/axis/regular.hpp>
#include <boost/histogram/axis/ostream.hpp>
#include <boost/histogram/axis/regular.hpp>
#include <boost/histogram/literals.hpp>
#include <boost/histogram/ostream.hpp>
#include <vector>
Expand Down
Loading