This commit is contained in:
Hans Dembinski
2018-11-13 17:17:37 +01:00
parent f07dde0575
commit bcfe032f66
2 changed files with 5 additions and 2 deletions

View File

@@ -33,6 +33,8 @@ class copyable_atomic : public std::atomic<T> {
public:
using std::atomic<T>::atomic;
copyable_atomic() = default;
// this is potentially not thread-safe
copyable_atomic(const copyable_atomic& rhs) { this->operator=(rhs); }

View File

@@ -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 <typename U>