aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/map.h
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2017-10-18 12:22:18 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2017-10-18 12:22:18 -0700
commit1a7a7fca804afa1cf67f8be5e71092898ba40334 (patch)
tree04b3da27c71c607510f34a12cf7856a1b94181ae /src/google/protobuf/map.h
parentc4f59dcc5c13debc572154c8f636b8a9361aacde (diff)
Merge from google internal
Diffstat (limited to 'src/google/protobuf/map.h')
-rw-r--r--src/google/protobuf/map.h24
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;
}