lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
Classes | Public Types | Public Member Functions
lean::containers::simple_hash_map< Key, Element, Policy, Hash, KeyValues, Pred, Allocator > Class Template Reference

Simple and fast hash map class, partially implementing the STL hash map interface. More...

#include <simple_hash_map.h>

Inheritance diagram for lean::containers::simple_hash_map< Key, Element, Policy, Hash, KeyValues, Pred, Allocator >:

List of all members.

Classes

class  basic_iterator
 Simple hash map iterator class. More...

Public Types

typedef Policy construction_policy
 Construction policy used.
typedef allocator_type_ allocator_type
 Type of the allocator used by this hash map.
typedef size_type_ size_type
 Type of the size returned by this hash map.
typedef
allocator_type::difference_type 
difference_type
 Type of the difference between the addresses of two elements in this hash map.
typedef allocator_type::pointer pointer
 Type of pointers to the elements contained by this hash map.
typedef
allocator_type::const_pointer 
const_pointer
 Type of constant pointers to the elements contained by this hash map.
typedef allocator_type::reference reference
 Type of references to the elements contained by this hash map.
typedef
allocator_type::const_reference 
const_reference
 Type of constant references to the elements contained by this hash map.
typedef allocator_type::value_type value_type
 Type of the elements contained by this hash map.
typedef Key key_type
 Type of the keys stored by this hash map.
typedef Element mapped_type
 Type of the elements contained by this hash map.
typedef basic_iterator
< value_type
iterator
 Type of iterators to the elements contained by this hash map.
typedef basic_iterator< const
value_type
const_iterator
 Type of constant iterators to the elements contained by this hash map.
typedef iterator local_iterator
 Type of iterators to the elements contained by this hash map.
typedef const_iterator const_local_iterator
 Type of constant iterators to the elements contained by this hash map.
typedef hasher_ hasher
 Type of the hash function.
typedef key_equal_ key_equal
 Type of the key comparison function.

Public Member Functions

 simple_hash_map ()
 Constructs an empty hash map.
 simple_hash_map (size_type capacity, float maxLoadFactor=0.75f)
 Constructs an empty hash map.
 simple_hash_map (size_type capacity, float maxLoadFactor, const hasher &hash)
 Constructs an empty hash map.
 simple_hash_map (size_type capacity, float maxLoadFactor, const hasher &hash, const key_equal &keyComp)
 Constructs an empty hash map.
 simple_hash_map (size_type capacity, float maxLoadFactor, const hasher &hash, const key_equal &keyComp, const allocator_type &allocator)
 Constructs an empty hash map.
 simple_hash_map (const simple_hash_map &right)
 Copies all elements from the given hash map to this hash map.
 ~simple_hash_map ()
 Destroys all elements in this hash map.
simple_hash_mapoperator= (const simple_hash_map &right)
 Copies all elements of the given hash map to this hash map.
LEAN_INLINE reference insert (const key_type &key)
 Inserts a default-constructed value into the hash map using the given key, if none stored under the given key yet, otherwise returns the one currently stored.
LEAN_INLINE std::pair
< iterator, bool > 
insert (const value_type &value)
 Inserts the given key-value-pair into this hash map.
LEAN_INLINE size_type erase (const key_type &key)
 Removes the element stored under the given key, if any.
LEAN_INLINE iterator erase (iterator where)
 Removes the element that the given iterator is pointing to.
LEAN_INLINE void clear ()
 Clears all elements from this hash map.
LEAN_INLINE void reserve (size_type newCapacity)
 Reserves space for the predicted number of elements given.
LEAN_INLINE void rehash (size_type newCapacity)
 Tries to grow or shrink the hash map to fit the given number of elements given. The hash map will never shrink below the number of elements currently stored.
LEAN_INLINE iterator find (const key_type &key)
 Gets an element by key, returning end() on failure.
LEAN_INLINE const_iterator find (const key_type &key) const
 Gets an element by key, returning end() on failure.
LEAN_INLINE mapped_typeoperator[] (const key_type &key)
 Gets an element by key, inserts a new default-constructed one if none existent yet.
LEAN_INLINE iterator begin (void)
 Returns an iterator to the first element contained by this hash map.
LEAN_INLINE const_iterator begin (void) const
 Returns a constant iterator to the first element contained by this hash map.
LEAN_INLINE iterator end (void)
 Returns an iterator beyond the last element contained by this hash map.
LEAN_INLINE const_iterator end (void) const
 Returns a constant iterator beyond the last element contained by this hash map.
LEAN_INLINE allocator_type get_allocator () const
 Gets a copy of the allocator used by this hash map.
LEAN_INLINE bool key_valid (const key_type &key) const
 Returns true if the given key is valid.
LEAN_INLINE bool empty (void) const
 Returns true if the hash map is empty.
LEAN_INLINE size_type size (void) const
 Returns the number of elements contained by this hash map.
LEAN_INLINE size_type capacity (void) const
 Returns the number of elements this hash map could contain without reallocation.
LEAN_INLINE size_type bucket_count () const
 Gets the current number of buckets.
LEAN_INLINE float max_load_factor () const
 Gets the maximum load factor.
void max_load_factor (float factor)
 Sets the maximum load factor.
LEAN_INLINE float load_factor () const
 Gets the current load factor.
size_type next_capacity_hint (size_type count) const
 Computes a new capacity based on the given number of elements to be stored.
LEAN_INLINE void swap (simple_hash_map &right) throw ()
 Swaps the contents of this hash map and the given hash map.
LEAN_INLINE size_type max_size () const
 Estimates the maximum number of elements that may be constructed.

Detailed Description

template<class Key, class Element, class Policy = simple_hash_map_policies::nonpod, class Hash = hash<Key>, class KeyValues = default_keys<Key>, class Pred = std::equal_to<Key>, class Allocator = std::allocator<Element>>
class lean::containers::simple_hash_map< Key, Element, Policy, Hash, KeyValues, Pred, Allocator >

Simple and fast hash map class, partially implementing the STL hash map interface.


The documentation for this class was generated from the following file: