P4C
The P4 Compiler
Loading...
Searching...
No Matches
assoc::hash_map< Key, T, Hash, Equal, Allocator > Class Template Reference

#include <assoc.h>

Inheritance diagram for assoc::hash_map< Key, T, Hash, Equal, Allocator >:
[legend]

Public Types

using mapped_type = typename ABase::mapped_type
 

Public Member Functions

void swap (hash_map &other) noexcept
 
const ABase & unstable_iterable () const
 

Detailed Description

template<typename Key, typename T, typename Hash = boost::hash<Key>, typename Equal = std::equal_to<Key>, typename Allocator = std::allocator<std::pair<const Key, T>>>
class assoc::hash_map< Key, T, Hash, Equal, Allocator >

Map container implemented as hashtable. Provides average constant time lookup. Member functions used for iteration (begin) are intentionaly not exposed to avoid accidental nondeterministic behavior of the compiler.

See also
namespace assoc

Member Function Documentation

◆ unstable_iterable()

template<typename Key , typename T , typename Hash = boost::hash<Key>, typename Equal = std::equal_to<Key>, typename Allocator = std::allocator<std::pair<const Key, T>>>
const ABase & assoc::hash_map< Key, T, Hash, Equal, Allocator >::unstable_iterable ( ) const
inline

Extract an iterable that can be iterated over even if this container is not iterable. This is intended for targeted use at places where it is actually safe to iterate over a container with unspecified order – i.e. in cases where the result does in no way depend on the iteration order. An example can be checking if a given value is present in the map.