small interface fix and adaptations to current boost develop

This commit is contained in:
Hans Dembinski 2020-01-31 23:58:33 +01:00 committed by GitHub
parent 3e882bce26
commit 0583e6598d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 53 additions and 17 deletions

View File

@ -34,8 +34,10 @@ matrix:
# ignore optional dependencies not currently supported by the cmake build
- python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" histogram -N accumulators -N range -N serialization -N units
# WORKAROUND: throw_exception tests have dependencies that depinst.py misses
# WORKAROUND: some external tests have extra dependencies that depinst.py misses
- python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" throw_exception
- python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" smart_ptr
- python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" move
script:
mkdir build && cd build &&

View File

@ -15,12 +15,12 @@
#include <boost/histogram/detail/static_if.hpp>
#include <boost/histogram/detail/try_cast.hpp>
#include <boost/histogram/detail/type_name.hpp>
#include <boost/histogram/detail/variant2_with_warnings_disabled.hpp>
#include <boost/histogram/fwd.hpp>
#include <boost/mp11/algorithm.hpp>
#include <boost/mp11/list.hpp>
#include <boost/mp11/utility.hpp>
#include <boost/throw_exception.hpp>
#include <boost/variant2/variant.hpp>
#include <stdexcept>
#include <string>
#include <utility>

View File

@ -14,11 +14,11 @@
#include <boost/histogram/detail/relaxed_equal.hpp>
#include <boost/histogram/detail/static_if.hpp>
#include <boost/histogram/detail/type_name.hpp>
#include <boost/histogram/detail/variant2_with_warnings_disabled.hpp>
#include <boost/histogram/detail/variant_proxy.hpp>
#include <boost/mp11/algorithm.hpp> // mp_contains
#include <boost/mp11/list.hpp> // mp_first
#include <boost/throw_exception.hpp>
#include <boost/variant2/variant.hpp>
#include <stdexcept>
#include <type_traits>
#include <utility>

View File

@ -11,11 +11,18 @@
#include <boost/mp11/algorithm.hpp>
#include <boost/mp11/function.hpp>
#include <boost/mp11/utility.hpp>
#include <boost/variant2/variant.hpp>
#include <iterator>
#include <tuple>
#include <type_traits>
// forward declaration
namespace boost {
namespace variant2 {
template <class...>
class variant;
} // namespace variant2
} // namespace boost
namespace boost {
namespace histogram {
namespace detail {

View File

@ -19,12 +19,12 @@
#include <boost/histogram/detail/optional_index.hpp>
#include <boost/histogram/detail/span.hpp>
#include <boost/histogram/detail/static_if.hpp>
#include <boost/histogram/detail/variant2_with_warnings_disabled.hpp>
#include <boost/histogram/fwd.hpp>
#include <boost/mp11/algorithm.hpp>
#include <boost/mp11/bind.hpp>
#include <boost/mp11/utility.hpp>
#include <boost/throw_exception.hpp>
#include <boost/variant2/variant.hpp>
#include <stdexcept>
#include <type_traits>
#include <utility>

View File

@ -7,8 +7,19 @@
#ifndef BOOST_HISTOGRAM_DETAIL_SPAN_HPP
#define BOOST_HISTOGRAM_DETAIL_SPAN_HPP
#if __cpp_constexpr >= 201603 && __cpp_deduction_guides >= 201703 && \
__cpp_lib_nonmember_container_access >= 201411 && __has_include(<span>)
#ifdef __has_include
#if __has_include(<version>)
#include <version>
#ifdef __cpp_lib_span
#if __cpp_lib_span >= 201902
#define BOOST_HISTOGRAM_DETAIL_HAS_STD_SPAN
#endif
#endif
#endif
#endif
#ifdef BOOST_HISTOGRAM_DETAIL_HAS_STD_SPAN
#include <span>
namespace boost {

View File

@ -0,0 +1,20 @@
// Copyright 2019 Hans Dembinski
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_HISTOGRAM_DETAIL_VARIANT2_WITH_WARNINGS_DISABLED_HPP
#define BOOST_HISTOGRAM_DETAIL_VARIANT2_WITH_WARNINGS_DISABLED_HPP
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_GCC, >= 5)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
#endif
#include <boost/variant2/variant.hpp>
#if BOOST_WORKAROUND(BOOST_GCC, >= 5)
#pragma GCC diagnostic pop
#endif
#endif

View File

@ -489,10 +489,8 @@ public:
}
/// Multiply all values with a scalar.
template <class V = value_type>
std::enable_if_t<(detail::has_operator_rmul<V, double>::value &&
detail::has_operator_rmul<storage_type, double>::value == true),
histogram&>
template <class S = storage_type>
std::enable_if_t<(detail::has_operator_rmul<S, double>::value == true), histogram&>
operator*=(const double x) {
// use special implementation of scaling if available
storage_ *= x;
@ -500,10 +498,8 @@ public:
}
/// Multiply all values with a scalar.
template <class V = value_type>
std::enable_if_t<(detail::has_operator_rmul<V, double>::value &&
detail::has_operator_rmul<storage_type, double>::value == false),
histogram&>
template <class S = storage_type>
std::enable_if_t<(detail::has_operator_rmul<S, double>::value == false), histogram&>
operator*=(const double x) {
// generic implementation of scaling
for (auto&& si : storage_) si *= x;

View File

@ -14,12 +14,12 @@
#include <boost/histogram/axis/category.hpp>
#include <boost/histogram/axis/integer.hpp>
#include <boost/histogram/axis/ostream.hpp>
#include <boost/histogram/detail/variant2_with_warnings_disabled.hpp>
#include <boost/histogram/histogram.hpp>
#include <boost/histogram/literals.hpp>
#include <boost/histogram/make_histogram.hpp>
#include <boost/histogram/ostream.hpp>
#include <boost/histogram/storage_adaptor.hpp>
#include <boost/variant2/variant.hpp>
#include <random>
#include <sstream>
#include <stdexcept>
@ -92,7 +92,7 @@ void run_tests(const std::vector<int>& x, const std::vector<int>& y,
h(1);
for (auto&& xi : x) h(xi);
// uses variant
boost::variant2::variant<int, std::vector<int>, std::string> v[1];
variant<int, std::vector<int>, std::string> v[1];
v[0] = 1;
h2.fill(v);
v[0] = x;