mirror of
https://github.com/boostorg/histogram.git
synced 2025-05-11 13:14:06 +00:00
remove some workarounds
This commit is contained in:
parent
4c1caf3462
commit
469a866ee6
@ -298,10 +298,9 @@ auto fill(const std::size_t offset, S& storage, A& axes, const Args& args) {
|
|||||||
return fill_2(growing{}, offset, storage, axes,
|
return fill_2(growing{}, offset, storage, axes,
|
||||||
pack_args<pos::start, pos::nargs>(typename pos::weight{},
|
pack_args<pos::start, pos::nargs>(typename pos::weight{},
|
||||||
typename pos::sample{}, args));
|
typename pos::sample{}, args));
|
||||||
else
|
return (BOOST_THROW_EXCEPTION(
|
||||||
return (BOOST_THROW_EXCEPTION(
|
std::invalid_argument("number of arguments != histogram rank")),
|
||||||
std::invalid_argument("number of arguments != histogram rank")),
|
storage.end());
|
||||||
storage.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 0)
|
#if BOOST_WORKAROUND(BOOST_MSVC, >= 0)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#define BOOST_HISTOGRAM_DETAIL_LINEARIZE_HPP
|
#define BOOST_HISTOGRAM_DETAIL_LINEARIZE_HPP
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/config/workaround.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/histogram/axis/option.hpp>
|
#include <boost/histogram/axis/option.hpp>
|
||||||
#include <boost/histogram/axis/traits.hpp>
|
#include <boost/histogram/axis/traits.hpp>
|
||||||
#include <boost/histogram/axis/variant.hpp>
|
#include <boost/histogram/axis/variant.hpp>
|
||||||
@ -19,17 +19,18 @@ namespace boost {
|
|||||||
namespace histogram {
|
namespace histogram {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 0)
|
|
||||||
#pragma warning(disable : 4127) // disable "warning" about using if constexpr
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// initial offset to out must be set
|
// initial offset to out must be set
|
||||||
template <class Index, class Opts>
|
template <class Index, class Opts>
|
||||||
std::size_t linearize(Opts, Index& out, const std::size_t stride,
|
std::size_t linearize(Opts, Index& out, const std::size_t stride,
|
||||||
const axis::index_type size, const axis::index_type idx) {
|
const axis::index_type size, const axis::index_type idx) {
|
||||||
constexpr bool u = Opts::test(axis::option::underflow);
|
constexpr bool u = Opts::test(axis::option::underflow);
|
||||||
constexpr bool o = Opts::test(axis::option::overflow);
|
constexpr bool o = Opts::test(axis::option::overflow);
|
||||||
if (std::is_same<Index, std::size_t>::value || (u && o)) {
|
#ifdef BOOST_NO_CXX17_IF_CONSTEXPR
|
||||||
|
if
|
||||||
|
#else
|
||||||
|
if constexpr
|
||||||
|
#endif
|
||||||
|
(std::is_same<Index, std::size_t>::value || (u && o)) {
|
||||||
BOOST_ASSERT(idx >= (u ? -1 : 0));
|
BOOST_ASSERT(idx >= (u ? -1 : 0));
|
||||||
BOOST_ASSERT(idx < (o ? size + 1 : size));
|
BOOST_ASSERT(idx < (o ? size + 1 : size));
|
||||||
BOOST_ASSERT(idx >= 0 || static_cast<std::size_t>(-idx * stride) <= out);
|
BOOST_ASSERT(idx >= 0 || static_cast<std::size_t>(-idx * stride) <= out);
|
||||||
@ -45,10 +46,6 @@ std::size_t linearize(Opts, Index& out, const std::size_t stride,
|
|||||||
return size + u + o;
|
return size + u + o;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 0)
|
|
||||||
#pragma warning(default : 4127)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class Index, class Axis, class Value>
|
template <class Index, class Axis, class Value>
|
||||||
std::size_t linearize(Index& out, const std::size_t stride, const Axis& ax,
|
std::size_t linearize(Index& out, const std::size_t stride, const Axis& ax,
|
||||||
const Value& v) {
|
const Value& v) {
|
||||||
|
@ -29,11 +29,6 @@ enum class coverage {
|
|||||||
all, /*!< iterate over all bins, including underflow and overflow */
|
all, /*!< iterate over all bins, including underflow and overflow */
|
||||||
};
|
};
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_CLANG, >= 0)
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wc++17-extensions"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Input iterator range over histogram bins with multi-dimensional index.
|
/** Input iterator range over histogram bins with multi-dimensional index.
|
||||||
|
|
||||||
The iterator returned by begin() can only be incremented. begin() may only be called
|
The iterator returned by begin() can only be incremented. begin() may only be called
|
||||||
@ -321,10 +316,6 @@ private:
|
|||||||
iterator begin_, end_;
|
iterator begin_, end_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_CLANG, >= 0)
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Generates an indexed range of <a
|
/** Generates an indexed range of <a
|
||||||
href="https://en.cppreference.com/w/cpp/named_req/ForwardIterator">forward iterators</a>
|
href="https://en.cppreference.com/w/cpp/named_req/ForwardIterator">forward iterators</a>
|
||||||
over the histogram cells.
|
over the histogram cells.
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/config/workaround.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/core/alloc_construct.hpp>
|
#include <boost/core/alloc_construct.hpp>
|
||||||
#include <boost/core/exchange.hpp>
|
#include <boost/core/exchange.hpp>
|
||||||
#include <boost/core/nvp.hpp>
|
#include <boost/core/nvp.hpp>
|
||||||
@ -434,10 +434,6 @@ public:
|
|||||||
// template <class Allocator>
|
// template <class Allocator>
|
||||||
// unlimited_storage(const unlimited_storage<Allocator>& s)
|
// unlimited_storage(const unlimited_storage<Allocator>& s)
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 0)
|
|
||||||
#pragma warning(disable : 4127) // disable "warning" about using if constexpr
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class Iterable, class = detail::requires_iterable<Iterable>>
|
template <class Iterable, class = detail::requires_iterable<Iterable>>
|
||||||
explicit unlimited_storage(const Iterable& s) {
|
explicit unlimited_storage(const Iterable& s) {
|
||||||
using std::begin;
|
using std::begin;
|
||||||
@ -448,16 +444,17 @@ public:
|
|||||||
constexpr auto ti = buffer_type::template type_index<V>();
|
constexpr auto ti = buffer_type::template type_index<V>();
|
||||||
constexpr auto nt = mp11::mp_size<typename buffer_type::types>::value;
|
constexpr auto nt = mp11::mp_size<typename buffer_type::types>::value;
|
||||||
const std::size_t size = static_cast<std::size_t>(std::distance(s_begin, s_end));
|
const std::size_t size = static_cast<std::size_t>(std::distance(s_begin, s_end));
|
||||||
if (ti < nt)
|
#ifdef BOOST_NO_CXX17_IF_CONSTEXPR
|
||||||
|
if
|
||||||
|
#else
|
||||||
|
if constexpr
|
||||||
|
#endif
|
||||||
|
(ti < nt)
|
||||||
buffer_.template make<V>(size, s_begin);
|
buffer_.template make<V>(size, s_begin);
|
||||||
else
|
else
|
||||||
buffer_.template make<double>(size, s_begin);
|
buffer_.template make<double>(size, s_begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 0)
|
|
||||||
#pragma warning(default : 4127)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class Iterable, class = detail::requires_iterable<Iterable>>
|
template <class Iterable, class = detail::requires_iterable<Iterable>>
|
||||||
unlimited_storage& operator=(const Iterable& s) {
|
unlimited_storage& operator=(const Iterable& s) {
|
||||||
*this = unlimited_storage(s);
|
*this = unlimited_storage(s);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user