From 1a7a7fca804afa1cf67f8be5e71092898ba40334 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Wed, 18 Oct 2017 12:22:18 -0700 Subject: Merge from google internal --- src/google/protobuf/map.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/google/protobuf/map.h') 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 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; } -- cgit v1.2.3