From 6ae3bde73dd9090712e22986afe866229e61d305 Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Tue, 25 Nov 2014 14:01:44 -0800 Subject: Fix issue 99. --- src/google/protobuf/map.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/google/protobuf/map.h') 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 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 { + return std::pair(first, second); + } + const Key first; T second; -- cgit v1.2.3