diff options
Diffstat (limited to 'src/google/protobuf/map.h')
-rw-r--r-- | src/google/protobuf/map.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 63db2925..7d9cc5c5 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -142,6 +142,26 @@ class Map { insert(other.begin(), other.end()); } +#if LANG_CXX11 + Map(Map&& other) noexcept : Map() { + if (other.arena_) { + *this = other; + } else { + swap(other); + } + } + Map& operator=(Map&& other) noexcept { + if (this != &other) { + if (arena_ != other.arena_) { + *this = other; + } else { + swap(other); + } + } + return *this; + } +#endif + template <class InputIt> Map(const InputIt& first, const InputIt& last) : arena_(NULL), default_enum_value_(0) { @@ -1036,12 +1056,12 @@ class Map { } const T& at(const key_type& key) const { const_iterator it = find(key); - GOOGLE_CHECK(it != end()); + GOOGLE_CHECK(it != end()) << "key not found: " << key; return it->second; } T& at(const key_type& key) { iterator it = find(key); - GOOGLE_CHECK(it != end()); + GOOGLE_CHECK(it != end()) << "key not found: " << key; return it->second; } |