map.h

#include <google/protobuf/map.h>
namespace google::protobuf

This file defines the map container and its helpers to support protobuf maps.

The Map and MapIterator types are provided by this header file. Please avoid using other types defined here, unless they are public types within Map or MapIterator, such as Map::value_type.

Classes in this file

Map is an associative container type used to store protobuf map fields.
Iterators.
This is the class for Map's internal value_type.
Map is an associative container type used to store protobuf map fields.
Iterators.

template class Map

#include <google/protobuf/map.h>
namespace google::protobuf

template <typename , typename >

Map is an associative container type used to store protobuf map fields.

Each Map instance may or may not use a different hash function, a different iteration order, and so on. E.g., please don't examine implementation details to decide if the following would work: Map<int, int> m0, m1; m0[[]0] = m1[[]0] = m0[[]1] = m1[[]1] = 0; assert(m0.begin()->first == m1.begin()->first); // Bug!

Map's interface is similar to std::unordered_map, except that Map is not designed to play well with exceptions.

Members

typedef
Key key_type
typedef
T mapped_type
typedef
MapPair< Key, T > value_type
typedef
value_type * pointer
typedef
value_type & reference
typedef
size_t size_type
typedef
hash< Key > hasher
const typedef value_type *
const_pointer
const typedef value_type &
const_reference
Map()
explicit
Map(Arena * arena)
Map(const Map & other)
Map(Map && other)
Map &
operator=(Map && other)
template
Map(const InputIt & first, const InputIt & last)
~Map()
iterator
begin()
iterator
end()
const_iterator
begin() const
const_iterator
end() const
const_iterator
cbegin() const
const_iterator
cend() const
size_type
size() const
Capacity.
bool
empty() const
T &
operator[](const key_type & key)
Element access.
const T &
at(const key_type & key) const
T &
at(const key_type & key)
size_type
count(const key_type & key) const
Lookup.
const_iterator
find(const key_type & key) const
iterator
find(const key_type & key)
bool
contains(const Key & key) const
std::pair< const_iterator, const_iterator >
equal_range(const key_type & key) const
std::pair< iterator, iterator >
equal_range(const key_type & key)
std::pair< iterator, bool >
insert(const value_type & value)
insert
template void
insert(InputIt first, InputIt last)
void
insert(std::initializer_list< value_type > values)
size_type
erase(const key_type & key)
Erase and clear.
iterator
erase(iterator pos)
void
erase(iterator first, iterator last)
void
clear()
Map &
operator=(const Map & other)
Assign.
void
swap(Map & other)
hasher
hash_function() const
Access to hasher. more...

hasher Map::hash_function() const

Access to hasher.

Currently this returns a copy, but it may be modified to return a const reference in the future.

class Map::const_iterator

#include <google/protobuf/map.h>
namespace google::protobuf

Iterators.

Members

typedef
std::forward_iterator_tag iterator_category
typedef
Map::value_type value_type
typedef
ptrdiff_t difference_type
const typedef value_type *
pointer
const typedef value_type &
reference
const_iterator()
explicit
const_iterator(const InnerIt & it)
const_reference
operator*() const
const_pointer
operator->() const
const_iterator &
operator++()
const_iterator
operator++(int )

class Map::iterator

#include <google/protobuf/map.h>
namespace google::protobuf

Members

typedef
std::forward_iterator_tag iterator_category
typedef
Map::value_type value_type
typedef
ptrdiff_t difference_type
typedef
value_type * pointer
typedef
value_type & reference
iterator()
explicit
iterator(const InnerIt & it)
reference
operator*() const
pointer
operator->() const
iterator &
operator++()
iterator
operator++(int )
operator const_iterator() const
Allow implicit conversion to const_iterator.

template struct is_proto_enum

#include <google/protobuf/map.h>
namespace google::protobuf

template <typename >

Members

template class MapPair

#include <google/protobuf/map.h>
namespace google::protobuf

template <typename , typename >

This is the class for Map's internal value_type.

Instead of using std::pair as value_type, we use this class which provides us more control of its process of construction and destruction.

Members

const typedef Key
first_type
const Key
first
T
second
typedef
T second_type
MapPair(const Key & other_first, const T & other_second)
explicit
MapPair(const Key & other_first)
MapPair(const MapPair & other)
~MapPair()
template
operator std::pair< T1, T2 >() const
Implicitly convertible to std::pair of compatible types.

template class Map

#include <google/protobuf/map.h>
namespace google::protobuf

template <typename , typename >

Map is an associative container type used to store protobuf map fields.

Each Map instance may or may not use a different hash function, a different iteration order, and so on. E.g., please don't examine implementation details to decide if the following would work: Map<int, int> m0, m1; m0[[]0] = m1[[]0] = m0[[]1] = m1[[]1] = 0; assert(m0.begin()->first == m1.begin()->first); // Bug!

Map's interface is similar to std::unordered_map, except that Map is not designed to play well with exceptions.

Members

typedef
Key key_type
typedef
T mapped_type
typedef
MapPair< Key, T > value_type
typedef
value_type * pointer
typedef
value_type & reference
typedef
size_t size_type
typedef
hash< Key > hasher
const typedef value_type *
const_pointer
const typedef value_type &
const_reference
Map()
explicit
Map(Arena * arena)
Map(const Map & other)
Map(Map && other)
Map &
operator=(Map && other)
template
Map(const InputIt & first, const InputIt & last)
~Map()
iterator
begin()
iterator
end()
const_iterator
begin() const
const_iterator
end() const
const_iterator
cbegin() const
const_iterator
cend() const
size_type
size() const
Capacity.
bool
empty() const
T &
operator[](const key_type & key)
Element access.
const T &
at(const key_type & key) const
T &
at(const key_type & key)
size_type
count(const key_type & key) const
Lookup.
const_iterator
find(const key_type & key) const
iterator
find(const key_type & key)
bool
contains(const Key & key) const
std::pair< const_iterator, const_iterator >
equal_range(const key_type & key) const
std::pair< iterator, iterator >
equal_range(const key_type & key)
std::pair< iterator, bool >
insert(const value_type & value)
insert
template void
insert(InputIt first, InputIt last)
void
insert(std::initializer_list< value_type > values)
size_type
erase(const key_type & key)
Erase and clear.
iterator
erase(iterator pos)
void
erase(iterator first, iterator last)
void
clear()
Map &
operator=(const Map & other)
Assign.
void
swap(Map & other)
hasher
hash_function() const
Access to hasher. more...

hasher Map::hash_function() const

Access to hasher.

Currently this returns a copy, but it may be modified to return a const reference in the future.

class Map::const_iterator

#include <google/protobuf/map.h>
namespace google::protobuf

Iterators.

Members

typedef
std::forward_iterator_tag iterator_category
typedef
Map::value_type value_type
typedef
ptrdiff_t difference_type
const typedef value_type *
pointer
const typedef value_type &
reference
const_iterator()
explicit
const_iterator(const InnerIt & it)
const_reference
operator*() const
const_pointer
operator->() const
const_iterator &
operator++()
const_iterator
operator++(int )

class Map::iterator

#include <google/protobuf/map.h>
namespace google::protobuf

Members

typedef
std::forward_iterator_tag iterator_category
typedef
Map::value_type value_type
typedef
ptrdiff_t difference_type
typedef
value_type * pointer
typedef
value_type & reference
iterator()
explicit
iterator(const InnerIt & it)
reference
operator*() const
pointer
operator->() const
iterator &
operator++()
iterator
operator++(int )
operator const_iterator() const
Allow implicit conversion to const_iterator.