aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/map.h
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2017-07-18 15:38:30 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2017-07-18 15:38:30 -0700
commit09354db1434859a31a3c81abebcc4018d42f2715 (patch)
treeb87c7cdc2255e6c8062ab92b4082665cd698d753 /src/google/protobuf/map.h
parent9053033a5076f82cf18b823c31f352e95e5bfd8d (diff)
Merge from Google internal for 3.4 release
Diffstat (limited to 'src/google/protobuf/map.h')
-rw-r--r--src/google/protobuf/map.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index 18ee3652..2d561c24 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -865,14 +865,7 @@ class Map {
size_type BucketNumber(const Key& k) const {
// We inherit from hasher, so one-arg operator() provides a hash function.
size_type h = (*const_cast<InnerMap*>(this))(k);
- // To help prevent people from making assumptions about the hash function,
- // we use the seed differently depending on NDEBUG. The default hash
- // function, the seeding, etc., are all likely to change in the future.
-#ifndef NDEBUG
- return (h * (seed_ | 1)) & (num_buckets_ - 1);
-#else
return (h + seed_) & (num_buckets_ - 1);
-#endif
}
bool IsMatch(const Key& k0, const Key& k1) const {
@@ -952,12 +945,16 @@ class Map {
public:
// Iterators
- class const_iterator
- : public std::iterator<std::forward_iterator_tag, value_type, ptrdiff_t,
- const value_type*, const value_type&> {
+ class const_iterator {
typedef typename InnerMap::const_iterator InnerIt;
public:
+ typedef std::forward_iterator_tag iterator_category;
+ typedef typename Map::value_type value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+
const_iterator() {}
explicit const_iterator(const InnerIt& it) : it_(it) {}
@@ -983,10 +980,16 @@ class Map {
InnerIt it_;
};
- class iterator : public std::iterator<std::forward_iterator_tag, value_type> {
+ class iterator {
typedef typename InnerMap::iterator InnerIt;
public:
+ typedef std::forward_iterator_tag iterator_category;
+ typedef typename Map::value_type value_type;
+ typedef ptrdiff_t difference_type;
+ typedef value_type* pointer;
+ typedef value_type& reference;
+
iterator() {}
explicit iterator(const InnerIt& it) : it_(it) {}