#include <google/protobuf/map.h>
namespace google::protobuf
Esse arquivo define o contêiner do mapa e seus auxiliares para oferecer suporte a mapas protobuf.
Os tipos Map e MapIterator são fornecidos por esse arquivo de cabeçalho. Evite usar outros tipos definidos aqui, a menos que sejam tipos públicos em Map ou MapIterator, como Map::value_type.
Turmas neste arquivo | |
---|---|
Esta é a classe para o value_type interno do Map. | |
Map é um tipo de contêiner associativo usado para armazenar campos do mapa protobuf. | |
Iteradores. | |
modelo de struct MapPair
#include <google/protobuf/map.h>
namespace google::protobuf
template <typename , typename >
Esta é a classe para o value_type interno do Map.
Em vez de usar std::pair como valor_type, usamos essa classe que nos dá mais controle do processo de construção e destruição.
Participantes | |
---|---|
typedef | const Key first_type |
typedef | T second_type |
const Key | first |
T | second |
| MapPair(const Key & other_first, const T & other_second) |
explicit | MapPair(const Key & other_first) |
explicit | MapPair(Key && other_first) |
| MapPair(const MapPair & other) |
| ~MapPair() |
template | operator std::pair< T1, T2 >() const Conversível implicitamente para std::pair de tipos compatíveis. |
classe do modelo Mapa
#include <google/protobuf/map.h>
namespace google::protobuf
template <typename , typename >
Map é um tipo de contêiner associativo usado para armazenar campos do mapa protobuf.
Cada instância de Map pode ou não usar uma função de hash diferente, uma ordem de iteração diferente e assim por diante. Por exemplo, não examine os detalhes de implementação para decidir se o seguinte funcionaria: Map<int, int> m0, m1; m0[[]0] = m1[[]0] = m0[[]1] = m1[[]1] = 0; assert(m0.begin()->first =- m1.begin()!
A interface do Map é semelhante a std::unordered_map, mas o Map não foi projetado para funcionar bem com exceções.
Participantes | |
---|---|
typedef | Key key_type |
typedef | T mapped_type |
typedef | MapPair< Key, T > value_type |
typedef | value_type * pointer |
typedef | const value_type * const_pointer |
typedef | value_type & reference |
typedef | const value_type & const_reference |
typedef | size_t size_type |
typedef | typename internal::TransparentSupport< Key >::hash hasher |
constexpr | 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 Capacidade. |
bool | empty() const |
template T & | operator[](const key_arg< K > & key) Acesso ao elemento. |
template T & | operator[](key_arg< K > && key) |
template const T & | at(const key_arg< K > & key) const |
template T & | at(const key_arg< K > & key) |
template size_type | count(const key_arg< K > & key) const Lookup. |
template const_iterator | find(const key_arg< K > & key) const |
template iterator | find(const key_arg< K > & key) |
template bool | contains(const key_arg< K > & key) const |
template std::pair< const_iterator, const_iterator > | equal_range(const key_arg< K > & key) const |
template std::pair< iterator, iterator > | equal_range(const key_arg< K > & key) |
std::pair< iterator, bool > | insert(const value_type & value) inserir |
template void | insert(InputIt first, InputIt last) |
void | insert(std::initializer_list< value_type > values) |
template size_type | erase(const key_arg< K > & key) Apagar e limpar. |
iterator | erase(iterator pos) |
void | |
void | clear() |
Map & | operator=(const Map & other) Atribuir. |
void | swap(Map & other) |
void | InternalSwap(Map & other) |
hasher | hash_function() const Acesso a hasher. mais… |
size_t | SpaceUsedExcludingSelfLong() const |
hasher Map::hash_function() const
Acesso a hasher.
No momento, isso retorna uma cópia, mas pode ser modificado para retornar uma referência contínua no futuro.
classe Map::const_iterator
#include <google/protobuf/map.h>
namespace google::protobuf
Iteradores.
Participantes | |
---|---|
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) |
const_reference | operator*() const |
const_pointer | operator->() const |
const_iterator & | operator++() |
const_iterator | operator++(int ) |
classe Map::iterator
#include <google/protobuf/map.h>
namespace google::protobuf
Participantes | |
---|---|
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) |
reference | operator*() const |
pointer | operator->() const |
iterator & | operator++() |
iterator | operator++(int ) |
| operator const_iterator() const Permitir a conversão implícita em const_iterator. |