| Index: compiled/Map.h |
| =================================================================== |
| --- a/compiled/Map.h |
| +++ b/compiled/Map.h |
| @@ -102,19 +102,21 @@ |
| { |
| public: |
| typedef Entry entry_type; |
| typedef typename Entry::key_type_cref key_type_cref; |
| typedef typename entry_type::size_type size_type; |
| typedef HashContainerIterator<Entry> const_iterator; |
| typedef HashContainerReference<const Entry> const_reference; |
| - private: |
| - explicit HashContainer(const HashContainer& other); |
| - void operator=(const HashContainer& other); |
| + explicit HashContainer(HashContainer&& other) = default; |
| + HashContainer& operator=(HashContainer&&) = default; |
| + |
| + explicit HashContainer(const HashContainer& other) = delete; |
| + void operator=(const HashContainer& other) = delete; |
| protected: |
| static constexpr size_type MIN_BUCKETS = 1; |
| static constexpr double LOAD_FACTOR = 0.8; |
| std::unique_ptr<entry_type[]> mBuckets; |
| size_type mBucketCount; |
| size_type mEntryCount; |
| @@ -149,40 +151,53 @@ |
| allocate(); |
| // Copy old entries into the new buffer |
| for (size_type i = 0; i < oldCount; i++) |
| { |
| entry_type& entry = oldBuckets[i]; |
| if (!entry.is_invalid() && !entry.is_deleted()) |
| { |
| - *find_bucket(entry.first) = entry; |
| + *find_bucket(entry.first) = std::move(entry); |
| mEntryCount++; |
| } |
| } |
| } |
| - entry_type* assign(entry_type* existing, const entry_type& entry) |
| + entry_type* _assign(entry_type* existing, const entry_type& entry) |
| { |
| if (existing->is_invalid()) |
| { |
| if (mEntryCount + 1 >= mBucketCount * LOAD_FACTOR) |
| { |
| resize(mBucketCount << 1); |
| existing = find_bucket(entry.first); |
| } |
| mEntryCount++; |
| #if defined(DEBUG) |
| mInsertCounter++; |
| #endif |
| } |
| + return existing; |
| + } |
| + |
| + entry_type* assign(entry_type* existing, const entry_type& entry) |
| + { |
| + existing = _assign(existing, entry); |
| *existing = entry; |
| return existing; |
| } |
| + entry_type* assign(entry_type* existing, entry_type&& entry) |
| + { |
| + existing = _assign(existing, entry); |
| + *existing = std::move(entry); |
| + return existing; |
| + } |
| + |
| void allocate() |
| { |
| mBuckets.reset(new entry_type[mBucketCount]); |
| // Working around https://github.com/waywardmonkeys/emscripten-trace-collector/issues/2 here |
| annotate_address(reinterpret_cast<size_type*>(mBuckets.get()) - 1, "Hash table buffer"); |
| } |
| public: |