Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski committed Apr 24, 2024
1 parent 67d8641 commit c849981
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions include/boost/histogram/accumulators/collector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,21 @@ class collector {
using const_pointer = typename container_type::const_pointer;

template <typename... Args>
collector(Args&&... args) : container_(std::forward<Args>(args)...) {}
explicit collector(Args&&... args) : container_(std::forward<Args>(args)...) {}

// we must explicitly implement the copy constructors so that they are better matches
// than the generic forwarding template above
collector(const collector& other) = default;
collector(collector& other) : container_(other.container_) {}
collector(collector&&) = default;

// when copy/move ctors are explicitly implemented, one also has to implement the
// assignment operators
collector& operator=(const collector&) = default;
collector& operator=(collector&&) = default;

template <class T, typename... Args>
collector(std::initializer_list<T> list, Args&&... args)
explicit collector(std::initializer_list<T> list, Args&&... args)
: container_(list, std::forward<Args>(args)...) {}

/// Append sample x.
Expand All @@ -59,7 +70,7 @@ class collector {
/// Return true if collections are equal.
///
/// Two collections are equal if they have the same number of elements
/// and they all compare equal.
/// which all compare equal.
template <class Iterable, class = detail::is_iterable<Iterable>>
bool operator==(const Iterable& rhs) const noexcept {
return std::equal(begin(), end(), rhs.begin(), rhs.end());
Expand Down Expand Up @@ -91,9 +102,6 @@ class collector {

allocator_type get_allocator() const { return container_.get_allocator(); }

// conversion to container_type must be explicit
explicit operator container_type() const noexcept { return container_; }

template <class Archive>
void serialize(Archive& ar, unsigned version) {
(void)version;
Expand Down

0 comments on commit c849981

Please sign in to comment.