Sierra Toolkit Version of the Day
eastl::hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode > Class Template Reference

#include <hash_map_eastl.h>

Inheritance diagram for eastl::hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode >:
Collaboration diagram for eastl::hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode >:

List of all members.

Public Types

typedef hashtable< Key,
eastl::pair< const Key, T >
, Allocator, eastl::use_first
< eastl::pair< const Key, T >
>, Predicate, Hash,
mod_range_hashing,
default_ranged_hash,
prime_rehash_policy,
bCacheHashCode, true, true > 
base_type
typedef hash_map< Key, T, Hash,
Predicate, Allocator,
bCacheHashCode > 
this_type
typedef base_type::size_type size_type
typedef base_type::key_type key_type
typedef T mapped_type
typedef base_type::value_type value_type
typedef base_type::allocator_type allocator_type
typedef base_type::node_type node_type
typedef
base_type::insert_return_type 
insert_return_type
typedef base_type::iterator iterator

Public Member Functions

 hash_map (const allocator_type &allocator=allocator_type(EASTL_DEFAULT_NAME_PREFIX" hash_map"))
 hash_map (size_type nBucketCount, const Hash &hashFunction=Hash(), const Predicate &predicate=Predicate(), const allocator_type &allocator=allocator_type(EASTL_DEFAULT_NAME_PREFIX" hash_map"))
template<typename ForwardIterator >
 hash_map (ForwardIterator first, ForwardIterator last, size_type nBucketCount=0, const Hash &hashFunction=Hash(), const Predicate &predicate=Predicate(), const allocator_type &allocator=allocator_type(EASTL_DEFAULT_NAME_PREFIX" hash_map"))
insert_return_type insert (const key_type &key)
mapped_type & operator[] (const key_type &key)

Detailed Description

template<typename Key, typename T, typename Hash = eastl::hash<Key>, typename Predicate = eastl::equal_to<Key>, typename Allocator = EASTLAllocatorType, bool bCacheHashCode = false>
class eastl::hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode >

hash_map

Implements a hash_map, which is a hashed associative container. Lookups are O(1) (that is, they are fast) but the container is not sorted.

set_max_load_factor If you want to make a hashtable never increase its bucket usage, call set_max_load_factor with a very high value such as 100000.f.

bCacheHashCode We provide the boolean bCacheHashCode template parameter in order to allow the storing of the hash code of the key within the map. When this option is disabled, the rehashing of the table will call the hash function on the key. Setting bCacheHashCode to true is useful for cases whereby the calculation of the hash value for a contained object is very expensive.

find_as In order to support the ability to have a hashtable of strings but be able to do efficiently lookups via char pointers (i.e. so they aren't converted to string objects), we provide the find_as function. This function allows you to do a find with a key of a type other than the hashtable key type.

Example find_as usage: hash_map<string, int> hashMap; i = hashMap.find_as("hello"); // Use default hash and compare.

Example find_as usage (namespaces omitted for brevity): hash_map<string, int> hashMap; i = hashMap.find_as("hello", hash<char*>(), equal_to_2<string, char*>());

Definition at line 126 of file hash_map_eastl.h.


Constructor & Destructor Documentation

template<typename Key , typename T , typename Hash = eastl::hash<Key>, typename Predicate = eastl::equal_to<Key>, typename Allocator = EASTLAllocatorType, bool bCacheHashCode = false>
eastl::hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode >::hash_map ( const allocator_type &  allocator = allocator_type( EASTL_DEFAULT_NAME_PREFIX " hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode >" )) [inline, explicit]

hash_map

Default constructor.

Definition at line 154 of file hash_map_eastl.h.

template<typename Key , typename T , typename Hash = eastl::hash<Key>, typename Predicate = eastl::equal_to<Key>, typename Allocator = EASTLAllocatorType, bool bCacheHashCode = false>
eastl::hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode >::hash_map ( size_type  nBucketCount,
const Hash &  hashFunction = Hash(),
const Predicate &  predicate = Predicate(),
const allocator_type &  allocator = allocator_type( EASTL_DEFAULT_NAME_PREFIX " hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode >" ) 
) [inline, explicit]

hash_map

Constructor which creates an empty container, but start with nBucketCount buckets. We default to a small nBucketCount value, though the user really should manually specify an appropriate value in order to prevent memory from being reallocated.

Definition at line 168 of file hash_map_eastl.h.

template<typename Key , typename T , typename Hash = eastl::hash<Key>, typename Predicate = eastl::equal_to<Key>, typename Allocator = EASTLAllocatorType, bool bCacheHashCode = false>
template<typename ForwardIterator >
eastl::hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode >::hash_map ( ForwardIterator  first,
ForwardIterator  last,
size_type  nBucketCount = 0,
const Hash &  hashFunction = Hash(),
const Predicate &  predicate = Predicate(),
const allocator_type &  allocator = allocator_type( EASTL_DEFAULT_NAME_PREFIX " hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode >" ) 
) [inline]

hash_map

An input bucket count of <= 1 causes the bucket count to be equal to the number of elements in the input range.

Definition at line 183 of file hash_map_eastl.h.


Member Function Documentation

template<typename Key , typename T , typename Hash = eastl::hash<Key>, typename Predicate = eastl::equal_to<Key>, typename Allocator = EASTLAllocatorType, bool bCacheHashCode = false>
insert_return_type eastl::hash_map< Key, T, Hash, Predicate, Allocator, bCacheHashCode >::insert ( const key_type &  key) [inline]

insert

This is an extension to the C++ standard. We insert a default-constructed element with the given key. The reason for this is that we can avoid the potentially expensive operation of creating and/or copying a mapped_type object on the stack.

Definition at line 198 of file hash_map_eastl.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines