mirror of
https://github.com/boostorg/histogram.git
synced 2025-05-09 14:57:57 +00:00
remove deprecated API, as previously announced (#359)
This commit is contained in:
parent
6ccc6a80a4
commit
9caf633366
@ -20,7 +20,6 @@
|
||||
#include <boost/histogram/accumulators/count.hpp>
|
||||
#include <boost/histogram/accumulators/mean.hpp>
|
||||
#include <boost/histogram/accumulators/sum.hpp>
|
||||
#include <boost/histogram/accumulators/thread_safe.hpp>
|
||||
#include <boost/histogram/accumulators/weighted_mean.hpp>
|
||||
#include <boost/histogram/accumulators/weighted_sum.hpp>
|
||||
|
||||
|
@ -93,15 +93,6 @@ std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>&
|
||||
return detail::handle_nonzero_width(os, x);
|
||||
}
|
||||
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_begin.hpp>
|
||||
template <class CharT, class Traits, class T>
|
||||
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
|
||||
const thread_safe<T>& x) {
|
||||
os << static_cast<T>(x);
|
||||
return os;
|
||||
}
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_end.hpp>
|
||||
|
||||
} // namespace accumulators
|
||||
} // namespace histogram
|
||||
} // namespace boost
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
|
||||
/// Return small part of the sum.
|
||||
const_reference small_part() const noexcept { return small_; }
|
||||
// note: windows.h illegially uses `#define small char`, cannot use method "small"
|
||||
|
||||
// lossy conversion to value type must be explicit
|
||||
explicit operator value_type() const noexcept { return value(); }
|
||||
@ -156,25 +157,6 @@ public:
|
||||
|
||||
// end: extra operators
|
||||
|
||||
// windows.h illegially uses `#define small char` which breaks this now deprecated API
|
||||
#if !defined(small)
|
||||
|
||||
/// Return large part of the sum.
|
||||
[[deprecated("use large_part() instead; "
|
||||
"large() will be removed in boost-1.80")]] const_reference
|
||||
large() const noexcept {
|
||||
return large_;
|
||||
}
|
||||
|
||||
/// Return small part of the sum.
|
||||
[[deprecated("use small_part() instead; "
|
||||
"small() will be removed in boost-1.80")]] const_reference
|
||||
small() const noexcept {
|
||||
return small_;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
value_type large_{};
|
||||
value_type small_{};
|
||||
|
@ -1,82 +0,0 @@
|
||||
// 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_ACCUMULATORS_THREAD_SAFE_HPP
|
||||
#define BOOST_HISTOGRAM_ACCUMULATORS_THREAD_SAFE_HPP
|
||||
|
||||
#include <atomic>
|
||||
#include <boost/core/nvp.hpp>
|
||||
#include <boost/histogram/fwd.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
namespace histogram {
|
||||
namespace accumulators {
|
||||
|
||||
// cannot use new mechanism with accumulators::thread_safe
|
||||
template <class T>
|
||||
struct is_thread_safe<thread_safe<T>> : std::true_type {};
|
||||
|
||||
/** Thread-safe adaptor for builtin integral numbers.
|
||||
|
||||
This adaptor uses atomic operations to make concurrent increments and additions safe for
|
||||
the stored value.
|
||||
|
||||
On common computing platforms, the adapted integer has the same size and
|
||||
alignment as underlying type. The atomicity is implemented with a special CPU
|
||||
instruction. On exotic platforms the size of the adapted number may be larger and/or the
|
||||
type may have different alignment, which means it cannot be tightly packed into arrays.
|
||||
|
||||
@tparam T type to adapt, must be an integral type.
|
||||
*/
|
||||
template <class T>
|
||||
class [[deprecated("use count<T, true> instead; "
|
||||
"thread_safe<T> will be removed in boost-1.79")]] thread_safe
|
||||
: public std::atomic<T> {
|
||||
public:
|
||||
using value_type = T;
|
||||
using super_t = std::atomic<T>;
|
||||
|
||||
thread_safe() noexcept : super_t(static_cast<T>(0)) {}
|
||||
// non-atomic copy and assign is allowed, because storage is locked in this case
|
||||
thread_safe(const thread_safe& o) noexcept : super_t(o.load()) {}
|
||||
thread_safe& operator=(const thread_safe& o) noexcept {
|
||||
super_t::store(o.load());
|
||||
return *this;
|
||||
}
|
||||
|
||||
thread_safe(value_type arg) : super_t(arg) {}
|
||||
thread_safe& operator=(value_type arg) {
|
||||
super_t::store(arg);
|
||||
return *this;
|
||||
}
|
||||
|
||||
thread_safe& operator+=(const thread_safe& arg) {
|
||||
operator+=(arg.load());
|
||||
return *this;
|
||||
}
|
||||
thread_safe& operator+=(value_type arg) {
|
||||
super_t::fetch_add(arg, std::memory_order_relaxed);
|
||||
return *this;
|
||||
}
|
||||
thread_safe& operator++() {
|
||||
operator+=(static_cast<value_type>(1));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive & ar, unsigned /* version */) {
|
||||
auto value = super_t::load();
|
||||
ar& make_nvp("value", value);
|
||||
super_t::store(value);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace accumulators
|
||||
} // namespace histogram
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
@ -33,10 +33,6 @@ namespace algorithm {
|
||||
*/
|
||||
using reduce_command = detail::reduce_command;
|
||||
|
||||
using reduce_option [[deprecated("use reduce_command instead; "
|
||||
"reduce_option will be removed in boost-1.80")]] =
|
||||
reduce_command; ///< deprecated
|
||||
|
||||
/** Shrink command to be used in `reduce`.
|
||||
|
||||
Command is applied to axis with given index.
|
||||
|
@ -192,12 +192,6 @@ struct is_reducible;
|
||||
template <class Axis>
|
||||
#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED
|
||||
using get_options = decltype(detail::traits_options<Axis>(detail::priority<2>{}));
|
||||
|
||||
template <class Axis>
|
||||
using static_options [[deprecated("use get_options instead; "
|
||||
"static_options will be removed in boost-1.80")]] =
|
||||
get_options<Axis>;
|
||||
|
||||
#else
|
||||
struct get_options;
|
||||
#endif
|
||||
@ -223,13 +217,6 @@ struct get_options;
|
||||
template <class Axis>
|
||||
#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED
|
||||
using is_inclusive = decltype(detail::traits_is_inclusive<Axis>(detail::priority<1>{}));
|
||||
|
||||
template <class Axis>
|
||||
using static_is_inclusive
|
||||
[[deprecated("use is_inclusive instead; "
|
||||
"static_is_inclusive will be removed in boost-1.80")]] =
|
||||
is_inclusive<Axis>;
|
||||
|
||||
#else
|
||||
struct is_inclusive;
|
||||
#endif
|
||||
|
@ -106,12 +106,6 @@ class mean;
|
||||
template <class ValueType = double>
|
||||
class weighted_mean;
|
||||
|
||||
template <class T>
|
||||
class thread_safe;
|
||||
|
||||
template <class T>
|
||||
struct is_thread_safe;
|
||||
|
||||
} // namespace accumulators
|
||||
|
||||
struct unsafe_access;
|
||||
|
@ -64,9 +64,6 @@ public:
|
||||
using value_type = typename std::iterator_traits<value_iterator>::value_type;
|
||||
|
||||
class iterator;
|
||||
using range_iterator [[deprecated("use iterator instead; "
|
||||
"range_iterator will be removed in boost-1.80")]] =
|
||||
iterator; ///< deprecated
|
||||
|
||||
/** Lightweight view to access value and index of current cell.
|
||||
|
||||
@ -86,9 +83,6 @@ public:
|
||||
|
||||
public:
|
||||
using const_reference = const axis::index_type&;
|
||||
using reference [[deprecated("use const_reference instead; "
|
||||
"reference will be removed in boost-1.80")]] =
|
||||
const_reference; ///< deprecated
|
||||
|
||||
/// implementation detail
|
||||
class const_iterator
|
||||
|
@ -99,8 +99,6 @@ if (Threads_FOUND)
|
||||
LINK_LIBRARIES Threads::Threads)
|
||||
boost_test(TYPE run SOURCES accumulators_count_thread_safe_test.cpp
|
||||
LINK_LIBRARIES Threads::Threads)
|
||||
boost_test(TYPE run SOURCES accumulators_thread_safe_test.cpp
|
||||
LINK_LIBRARIES Threads::Threads)
|
||||
|
||||
endif()
|
||||
|
||||
|
@ -123,7 +123,6 @@ alias threading :
|
||||
[ run histogram_threaded_test.cpp ]
|
||||
[ run storage_adaptor_threaded_test.cpp ]
|
||||
[ run accumulators_count_thread_safe_test.cpp ]
|
||||
[ run accumulators_thread_safe_test.cpp ]
|
||||
:
|
||||
<threading>multi
|
||||
;
|
||||
|
@ -32,13 +32,6 @@ int main() {
|
||||
BOOST_TEST_EQ(str(sum, 15, false), " sum(1 + 0)"s);
|
||||
BOOST_TEST_EQ(str(sum, 15, true), "sum(1 + 0) "s);
|
||||
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_begin.hpp>
|
||||
|
||||
BOOST_TEST_EQ(sum.large(), 1);
|
||||
BOOST_TEST_EQ(sum.small(), 0);
|
||||
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_end.hpp>
|
||||
|
||||
sum += 1e100;
|
||||
BOOST_TEST_EQ(sum, (s_t{1e100, 1}));
|
||||
++sum;
|
||||
|
@ -1,38 +0,0 @@
|
||||
// Copyright 2015-2018 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)
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/histogram/accumulators/ostream.hpp>
|
||||
#include <boost/histogram/accumulators/thread_safe.hpp>
|
||||
#include <sstream>
|
||||
#include "throw_exception.hpp"
|
||||
#include "utility_str.hpp"
|
||||
|
||||
using namespace boost::histogram;
|
||||
using namespace std::literals;
|
||||
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_begin.hpp>
|
||||
|
||||
int main() {
|
||||
using ts_t = accumulators::thread_safe<int>;
|
||||
|
||||
ts_t i;
|
||||
++i;
|
||||
i += 1000;
|
||||
|
||||
BOOST_TEST_EQ(i, 1001);
|
||||
BOOST_TEST_EQ(str(i), "1001"s);
|
||||
|
||||
ts_t j{5};
|
||||
i = j;
|
||||
BOOST_TEST_EQ(i, 5);
|
||||
|
||||
BOOST_TEST_EQ(ts_t{} += ts_t{}, ts_t{});
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_end.hpp>
|
@ -30,7 +30,7 @@ root_include_path = include_path[: include_path.rindex("boost")]
|
||||
for root, dirs, files in os.walk(include_path):
|
||||
for fn in files:
|
||||
fn = os.path.join(root, fn)
|
||||
fn = fn[len(root_include_path) :]
|
||||
fn = fn[len(root_include_path) :] # noqa
|
||||
if fn.endswith("debug.hpp"): # is never included
|
||||
continue
|
||||
all_headers.add(fn)
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <boost/histogram/accumulators/mean.hpp>
|
||||
#include <boost/histogram/accumulators/ostream.hpp>
|
||||
#include <boost/histogram/accumulators/sum.hpp>
|
||||
#include <boost/histogram/accumulators/thread_safe.hpp>
|
||||
#include <boost/histogram/accumulators/weighted_sum.hpp>
|
||||
#include <boost/histogram/axis/category.hpp>
|
||||
#include <boost/histogram/axis/integer.hpp>
|
||||
@ -129,28 +128,6 @@ void run_tests() {
|
||||
BOOST_TEST_CSTR_EQ(str(h, 40).c_str(), expected);
|
||||
}
|
||||
|
||||
// regular with accumulators::thread_safe
|
||||
{
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_begin.hpp>
|
||||
auto h =
|
||||
make_s(Tag(), dense_storage<accumulators::thread_safe<int>>(), R2(3, -0.5, 1.0));
|
||||
h.at(0) = 1;
|
||||
h.at(1) = 10;
|
||||
h.at(2) = 5;
|
||||
|
||||
const auto expected = "BEGIN\n"
|
||||
"histogram(regular(3, -0.5, 1, options=none))\n"
|
||||
" ┌───────────────────────┐\n"
|
||||
"[-0.5, 0) 1 │██▎ │\n"
|
||||
"[ 0, 0.5) 10 │██████████████████████ │\n"
|
||||
"[ 0.5, 1) 5 │███████████ │\n"
|
||||
" └───────────────────────┘\n"
|
||||
"END";
|
||||
|
||||
BOOST_TEST_CSTR_EQ(str(h, 40).c_str(), expected);
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_end.hpp>
|
||||
}
|
||||
|
||||
// regular with accumulators::sum
|
||||
{
|
||||
auto h = make_s(Tag(), dense_storage<accumulators::sum<double>>(), R2(3, -0.5, 1.0));
|
||||
|
@ -14,3 +14,6 @@
|
||||
#include <boost/histogram.hpp>
|
||||
#include <boost/histogram/ostream.hpp>
|
||||
#include <boost/histogram/serialization.hpp>
|
||||
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_begin.hpp>
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_end.hpp>
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <array>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/histogram/accumulators/count.hpp>
|
||||
#include <boost/histogram/accumulators/thread_safe.hpp>
|
||||
#include <boost/histogram/serialization.hpp>
|
||||
#include <boost/histogram/storage_adaptor.hpp>
|
||||
#include <cassert>
|
||||
@ -43,10 +42,6 @@ int main(int argc, char** argv) {
|
||||
join(argv[1], "storage_adaptor_serialization_test_map_double.xml"));
|
||||
test_serialization<std::vector<accumulators::count<int, true>>>(
|
||||
join(argv[1], "storage_adaptor_serialization_test_vector_thread_safe_int.xml"));
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_begin.hpp>
|
||||
test_serialization<std::vector<accumulators::thread_safe<int>>>(
|
||||
join(argv[1], "storage_adaptor_serialization_test_vector_thread_safe_int.xml"));
|
||||
#include <boost/histogram/detail/ignore_deprecation_warning_end.hpp>
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user