diff --git a/examples/guide_parallel_filling.cpp b/examples/guide_parallel_filling.cpp index 2f0a46a3..475eb770 100644 --- a/examples/guide_parallel_filling.cpp +++ b/examples/guide_parallel_filling.cpp @@ -33,6 +33,8 @@ class copyable_atomic : public std::atomic { public: using std::atomic::atomic; + copyable_atomic() = default; + // this is potentially not thread-safe copyable_atomic(const copyable_atomic& rhs) { this->operator=(rhs); } diff --git a/include/boost/histogram/storage_adaptor.hpp b/include/boost/histogram/storage_adaptor.hpp index 88376591..84ad22cd 100644 --- a/include/boost/histogram/storage_adaptor.hpp +++ b/include/boost/histogram/storage_adaptor.hpp @@ -176,9 +176,10 @@ struct map_augmentation : T { value_type& operator[](std::size_t i) { return T::operator[](i); } - value_type operator[](std::size_t i) const { + const value_type& operator[](std::size_t i) const { auto it = this->find(i); - return it == this->end() ? value_type() : it->second; + static auto null = value_type(); + return it == this->end() ? null : it->second; } template