diff options
Diffstat (limited to 'src/google/protobuf/map.h')
-rw-r--r-- | src/google/protobuf/map.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index e55a6d43..f6ae3e52 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -56,7 +56,7 @@ class MapField; template <typename Key, typename T> class MapPair { public: - typedef Key first_type; + typedef const Key first_type; typedef T second_type; MapPair(const Key& other_first, const T& other_second) @@ -67,14 +67,13 @@ class MapPair { MapPair(const MapPair& other) : first(other.first), second(other.second) {} - MapPair& operator=(const MapPair& other) { - first = other.first; - second = other.second; - return *this; - } - ~MapPair() {} + // Implicitly convertible to std::pair. + operator std::pair<const Key, T>() const { + return std::pair<const Key, T>(first, second); + } + const Key first; T second; |