diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2014-11-25 14:01:44 -0800 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2014-11-25 14:01:44 -0800 |
commit | 6ae3bde73dd9090712e22986afe866229e61d305 (patch) | |
tree | 91175cad07b13034c3a9b574ca19182093a26653 /src/google/protobuf/map.h | |
parent | 7f3a25bebdcf732d7f43518c9b03a5a92b4be9e1 (diff) | |
download | protobuf-6ae3bde73dd9090712e22986afe866229e61d305.tar.gz protobuf-6ae3bde73dd9090712e22986afe866229e61d305.tar.bz2 protobuf-6ae3bde73dd9090712e22986afe866229e61d305.zip |
Fix issue 99.
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; |