Public Types | Public Member Functions | Related Functions
ash::sparse_hashset< Value, HashFx, EqualKey, Alloc > Class Template Reference

A STL-like hashset with sparse_hashtable as the backend. More...

#include <ash/sparse_hashset.h>

List of all members.

Public Types

typedef ht::key_type key_type
 The type used to identify elements.
typedef ht::value_type value_type
 The type of the object the container holds.
typedef ht::hasher hasher
 The functor type used to hash keys.
typedef ht::key_equal key_equal
 The functor used to compare keys for equality.
typedef Alloc allocator_type
 
typedef ht::size_type size_type
 The unsigned type used to represent the size of the container.
typedef ht::difference_type difference_type
 The signed integral type used to represent the distance between iterators.
typedef ht::const_pointer pointer
 The type that serves as a pointer to value_type.
typedef ht::const_pointer const_pointer
 The type that serves as a const pointer to value_type.
typedef ht::const_reference reference
 The type that serves as a reference to value_type.
typedef ht::const_reference const_reference
 The type that serves as a pointer to value_type.
typedef ht::const_iterator iterator
 The type used to iterate through the contents of the container.
typedef ht::const_iterator const_iterator
 The const type used to iterate through the contents of the container.
typedef ht::const_local_iterator local_iterator
 
typedef ht::const_local_iterator const_local_iterator
 

Public Member Functions

key_type deleted_key () const
 Get the key used for deleted buckets.
void set_deleted_key (key_type const &key)
 Set the key to use for deleted buckets.
void clear_deleted_key ()
 Clear the key used for deleted buckets.
bool operator== (sparse_hashset const &shs) const
 Equality operator.
Iterator Methods
iterator begin () const
 Get an iterator to the beginning.
iterator end () const
 Get an iterator to the end.
local_iterator begin (size_type i) const
 
local_iterator end (size_type i) const
 
Accessor Methods
hasher hash_funct () const
 Get the hash functor used by the container.
hasher hash_function () const
 Get the hash functor used by the container.
key_equal key_eq () const
 Get the key comparison functor used by the container.
Constructors/Destructors

We use the default copy constructor.

We use the default destructor.

 sparse_hashset (size_type n=0, hasher const &h=hasher(), key_equal const &k=key_equal())
 Default constructor.
template<class InputIterator >
 sparse_hashset (InputIterator f, InputIterator l, size_type n=0, hasher const &h=hasher(), key_equal const &k=key_equal())
 Iterative constructor.
void swap (sparse_hashset &c)
 Swap method.
Size Methods
size_type size () const
 Get the size of the container.
size_type max_size () const
 Get the maximum size of the container.
bool empty () const
 Check if the container is empty.
size_type bucket_count () const
 
size_type max_bucket_count () const
 
size_type bucket_size (size_type i) const
 
size_type bucket (key_type const &key) const
 
float load_factor () const
 
float max_load_factor () const
 
void max_load_factor (float new_grow)
 
float min_load_factor () const
 Get the minimum load factor.
void min_load_factor (float new_shrink)
 Set the minimum load factor.
void set_resizing_parameters (float shrink, float grow) __attribute__((__deprecated__))
void resize (size_type n)
 Resize the container to hold at least n elements.
void rehash (size_type n)
 
Lookup Methods
iterator find (key_type const &key) const
 Find an element.
size_type count (key_type const &key) const
 Count the number of elements with a given key.
pair< iterator, iteratorequal_range (key_type const &key) const
 Find all elements matching a given key.
Insertion Methods
pair< iterator, bool > insert (const_reference obj)
 Insert an element into the container.
template<class InputIterator >
void insert (InputIterator f, InputIterator l)
 Insert a range of elements [f,l) into the container.
void insert (const_iterator f, const_iterator l)
 Insert a range of elements [f,l) into the container.
iterator insert (iterator, const_reference obj)
 Insert sematics for std::insert_iterator.
Deletion Methods
void clear ()
 Erase all elements.
size_type erase (key_type const &key)
 Erase an element.
void erase (iterator itr)
 Erase an element.
void erase (iterator f, iterator l)
 Erase a range of elements.
I/O Methods
bool write_metadata (FILE *fp)
 Write the container contents to file in a byte-order-independent format.
bool read_metadata (FILE *fp)
 Read the container contents from a file written by write_metadata().
bool write_nopointer_data (FILE *fp)
 Write the container contents to file in an architecture-dependent format.
bool read_nopointer_data (FILE *fp)
 Read the container contents from a file written by write_nopointer_data().

Related Functions

(Note that these are not member functions.)

template<class Val , class HashFx , class EqualKey , class Alloc >
void swap (sparse_hashset< Val, HashFx, EqualKey, Alloc > &x, sparse_hashset< Val, HashFx, EqualKey, Alloc > &y)
 Global swap function.

Detailed Description

template<class Value, class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
class ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >

A STL-like hashset with sparse_hashtable as the backend.

Concepts:
stl::unique_hashed_associative_container
Concepts:
stl::simple_associative_container
Template Parameters:
ValueThe type of object stored by the sparse_hashset. Also defined as sparse_hashset::value_type.
HashFxThe hash functor used by the sparse_hashset. Also defined as sparse_hashset::hasher.
EqualKeyThe sparse_hashset key equality functor: a binary predicate that determines whether two keys are equal. Also defined as sparse_hashset::key_equal.
AllocThe allocator to use for internal memory management.

This is just a very thin wrapper over sparse_hashtable, just like sgi stl's stl_hash_set is a very thin wrapper over stl_hashtable. The major thing we define is operator[], because we have a concept of a data_type which stl_hashtable doesn't (it only has a key and a value).

This is more different from sparse_hashmap than you might think, because all iterators for sets are const (you obviously can't change the key, and for sets there is no value).

We adhere mostly to the STL semantics for hash_set. One important exception is that insert() may invalidate iterators entirely -- STL semantics are that insert() may reorder iterators, but they all still refer to something valid in the hashtable. Not so for us. Likewise, insert() may invalidate pointers into the hashtable. (Whether insert invalidates iterators and pointers depends on whether it results in a hashtable resize). On the plus side, delete() doesn't invalidate iterators or pointers at all, or even change the ordering of elements.

Here are a few "power user" tips:

1) set_deleted_key(): If you want to use erase() you must call set_deleted_key(), in addition to set_empty_key(), after construction. The deleted and empty keys must differ.

2) resize(0): When an item is deleted, its memory isn't freed right away. This allows you to iterate over a hashtable, and call erase(), without invalidating the iterator. To force the memory to be freed, call resize(0). For tr1 compatibility, this can also be called as rehash(0).

3) min_load_factor(0.0) Setting the minimum load factor to 0.0 guarantees that the hash table will never shrink.

Roughly speaking: (1) dense_hashset: fastest, uses the most memory unless entries are small (2) sparse_hashset: slowest, uses the least memory (3) hash_set / unordered_set (STL): in the middle

Todo:
csilvers: implement Alloc get_allocator() const;

Member Typedef Documentation

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef Alloc ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::allocator_type



Concept: tr1::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::const_iterator ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::const_iterator

The const type used to iterate through the contents of the container.



Concept: stl::simple_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::const_local_iterator ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::const_local_iterator



Concept: tr1::unordered_set

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::const_pointer ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::const_pointer

The type that serves as a const pointer to value_type.



Concept: stl::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::const_reference ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::const_reference

The type that serves as a pointer to value_type.



Concept: stl::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::difference_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::difference_type

The signed integral type used to represent the distance between iterators.



Concept: stl::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::hasher ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::hasher

The functor type used to hash keys.



Concept: stl::hashed_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::const_iterator ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::iterator

The type used to iterate through the contents of the container.



Concept: stl::simple_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::key_equal ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::key_equal

The functor used to compare keys for equality.



Concept: stl::hashed_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::key_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::key_type

The type used to identify elements.



Concept: stl::simple_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::const_local_iterator ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::local_iterator



Concept: tr1::unordered_set

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::const_pointer ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::pointer

The type that serves as a pointer to value_type.



Concept: stl::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::const_reference ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::reference

The type that serves as a reference to value_type.



Concept: stl::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::size_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::size_type

The unsigned type used to represent the size of the container.



Concept: stl::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
typedef ht::value_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::value_type

The type of the object the container holds.

Must be Assignable .

Concept: stl::simple_associative_container


Constructor & Destructor Documentation

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::sparse_hashset ( size_type  n = 0,
hasher const &  h = hasher(),
key_equal const &  k = key_equal() 
) [inline, explicit]

Default constructor.

Parameters:
nThe number of expected elements.
hThe hasher object to copy, if any.
kThe key_equal object to copy, if any.
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
template<class InputIterator >
ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::sparse_hashset ( InputIterator  f,
InputIterator  l,
size_type  n = 0,
hasher const &  h = hasher(),
key_equal const &  k = key_equal() 
) [inline]

Iterative constructor.

Parameters:
fThe beginning of the range of elements to insert.
lThe end of the range of elements to insert.
nThe number of expected elements.
hThe hasher object to copy, if any.
kThe key_equal object to copy, if any.

Member Function Documentation

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
iterator ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::begin ( ) const [inline]

Get an iterator to the beginning.

Returns:
An iterator to the beginning of the container.


Concept: stl::simple_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
local_iterator ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::begin ( size_type  i) const [inline]



Concept: tr1::unordered_set

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
size_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::bucket ( key_type const &  key) const [inline]
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
size_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::bucket_count ( ) const [inline]
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
size_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::bucket_size ( size_type  i) const [inline]
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::clear ( ) [inline]

Erase all elements.



Concept: stl::associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::clear_deleted_key ( ) [inline]

Clear the key used for deleted buckets.

Attention:
MAKES THE CONTAINER INSERT-ONLY!
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
size_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::count ( key_type const &  key) const [inline]

Count the number of elements with a given key.

Parameters:
keyThe key to search for.
Returns:
The number of elements matching key. Because this is a Unique Associative Container , the return value will be 0 or 1.


Concept: stl::unique_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
key_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::deleted_key ( ) const [inline]

Get the key used for deleted buckets.

Returns:
A copy of the deleted key.
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
bool ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::empty ( ) const [inline]

Check if the container is empty.

Returns:
True if the container is empty.


Concept: stl::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
iterator ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::end ( ) const [inline]

Get an iterator to the end.

Returns:
An iterator to the end of the container.


Concept: stl::simple_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
local_iterator ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::end ( size_type  i) const [inline]



Concept: tr1::unordered_set

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
pair<iterator, iterator> ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::equal_range ( key_type const &  key) const [inline]

Find all elements matching a given key.

Parameters:
keyThe key to search for.
Returns:
A pair of const_iterators for the range of elements [first,second). Because this is a Unique Associative Container , the first const_iterator points to the element, or to the end() if not found. The second const_iterator points to 1 past the first, or to the end().


Concept: stl::unique_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
size_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::erase ( key_type const &  key) [inline]

Erase an element.

Parameters:
keyThe key of the element to erase.
Returns:
The number of erased elements.


Concept: stl::associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::erase ( iterator  itr) [inline]

Erase an element.

Parameters:
itrAn iterator pointing to the element to erase.


Concept: stl::associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::erase ( iterator  f,
iterator  l 
) [inline]

Erase a range of elements.

Parameters:
fThe beginning of the range to erase.
lThe end of the range to erase.


Concept: stl::associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
iterator ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::find ( key_type const &  key) const [inline]

Find an element.

Parameters:
keyThe key of the element to search for.
Returns:
A const_iterator to the element, or to the end() if not found.


Concept: stl::associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
hasher ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::hash_funct ( ) const [inline]

Get the hash functor used by the container.

Returns:
A copy of the container's hasher object.


Concept: stl::hashed_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
hasher ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::hash_function ( ) const [inline]

Get the hash functor used by the container.

Returns:
A copy of the container's hasher object.


Concept: tr1::unordered_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
pair<iterator, bool> ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::insert ( const_reference  obj) [inline]

Insert an element into the container.

Parameters:
objThe element to insert.
Returns:
An iterator and a bool. The iterator points to the inserted element, or to another with the same key if one is already in the container. The bool is true if the element was inserted, and false in the case of a duplicate key.


Concept: stl::unique_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
template<class InputIterator >
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::insert ( InputIterator  f,
InputIterator  l 
) [inline]

Insert a range of elements [f,l) into the container.

Parameters:
fThe beginning of the range to insert.
lThe end of the range to insert.

Elements with duplicate keys will be ignored.

Concept: stl::unique_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::insert ( const_iterator  f,
const_iterator  l 
) [inline]

Insert a range of elements [f,l) into the container.

Parameters:
fThe beginning of the range to insert.
lThe end of the range to insert.

Elements with duplicate keys will be ignored.

Concept: stl::unique_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
iterator ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::insert ( iterator  ,
const_reference  obj 
) [inline]

Insert sematics for std::insert_iterator.

Note:
The passed-in iterator is ignored.
Parameters:
objThe element to insert.
Returns:
An iterator pointing to the element.
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
key_equal ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::key_eq ( ) const [inline]

Get the key comparison functor used by the container.

Returns:
A copy of the container's key_equal object.


Concept: stl::hashed_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
float ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::load_factor ( ) const [inline]
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
size_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::max_bucket_count ( ) const [inline]
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
float ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::max_load_factor ( ) const [inline]
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::max_load_factor ( float  new_grow) [inline]
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
size_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::max_size ( ) const [inline]

Get the maximum size of the container.

Returns:
The maximum number of elements the container can hold.


Concept: stl::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
float ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::min_load_factor ( ) const [inline]

Get the minimum load factor.

Returns:
The min load factor before the container shrinks.
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::min_load_factor ( float  new_shrink) [inline]

Set the minimum load factor.

Parameters:
new_shrinkThe min load factor before the container shrinks.
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
bool ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::operator== ( sparse_hashset< Value, HashFx, EqualKey, Alloc > const &  shs) const [inline]

Equality operator.

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
bool ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::read_metadata ( FILE *  fp) [inline]

Read the container contents from a file written by write_metadata().

Parameters:
fpThe file to read.
Returns:
True if successful.
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
bool ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::read_nopointer_data ( FILE *  fp) [inline]

Read the container contents from a file written by write_nopointer_data().

Parameters:
fpThe file to read.
Returns:
True if successful.
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::rehash ( size_type  n) [inline]
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::resize ( size_type  n) [inline]

Resize the container to hold at least n elements.

Parameters:
nThe number of elements the container is expected to hold.


Concept: stl::hashed_associative_container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::set_deleted_key ( key_type const &  key) [inline]

Set the key to use for deleted buckets.

Attention:
YOU MUST CALL THIS BEFORE DELETING ELEMENTS!
Parameters:
keyThe key reserved for deleted buckets.
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::set_resizing_parameters ( float  shrink,
float  grow 
) [inline]
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
size_type ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::size ( ) const [inline]

Get the size of the container.

Returns:
The number of elements in the container.


Concept: stl::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
void ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::swap ( sparse_hashset< Value, HashFx, EqualKey, Alloc > &  c) [inline]

Swap method.



Concept: stl::container

template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
bool ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::write_metadata ( FILE *  fp) [inline]

Write the container contents to file in a byte-order-independent format.

Parameters:
fpThe file to write.
Returns:
True if successful.
template<class Value , class HashFx = _ASH_HASH<Value>, class EqualKey = equal_to<Value>, class Alloc = libc_allocator_with_realloc<Value>>
bool ash::sparse_hashset< Value, HashFx, EqualKey, Alloc >::write_nopointer_data ( FILE *  fp) [inline]

Write the container contents to file in an architecture-dependent format.

Parameters:
fpThe file to write.
Returns:
True if successful.

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


© 2012   AshTL
Licensed under  AGPLv3
Hosted by  Get AshTL at SourceForge.net. Fast, secure and Free Open Source software downloads
Generated by  doxygen 1.7.4