Util--  1.1
Public Types | Public Member Functions | Friends | List of all members
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal > Class Template Reference

Hashing based table. More...

#include <utilmm/hash/bits/table.hh>

Inheritance diagram for utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >:
Inheritance graph
[legend]

Public Types

typedef Value value_type
 Value type for cells. More...
 
typedef Key key_type
 Key type. More...
 
typedef size_t size_type
 Size type. More...
 
typedef arg_traits< value_type >::type value_arg
 
typedef arg_traits< key_type >::type key_arg
 
typedef iter< Key, Value, Extract, Hash, Equal > iterator
 iterator type More...
 
typedef const_iter< Key, Value, Extract, Hash, Equal > const_iterator
 const iterator type More...
 

Public Member Functions

 table ()
 Default constructor. More...
 
 table (table const &)
 Copy constructor. More...
 
 ~table ()
 Copy destructor. More...
 
void swap (table &other)
 swapping values function More...
 
tableoperator= (table const &other)
 Copy operator. More...
 
size_type size () const
 element count More...
 
size_type max_size () const
 max elmement number More...
 
bool empty () const
 Emptyness test. More...
 
iterator begin ()
 Beginning of table. More...
 
iterator end ()
 End of table. More...
 
const_iterator begin () const
 Beginning of table. More...
 
const_iterator end () const
 End of table. More...
 
std::pair< iterator, iteratorequal_range (key_arg key)
 equality range More...
 
std::pair< const_iterator, const_iteratorequal_range (key_arg key) const
 equality range. More...
 
void erase (iterator const &first, iterator const &last)
 Remove elements. More...
 
std::pair< iterator, bool > insert_unique (value_arg v)
 Unique key insertion. More...
 
iterator insert_multiple (value_arg v)
 multiple insertion More...
 
void clear ()
 remove all elements More...
 

Friends

template<typename K , typename V , class Ex , class H , class Eq >
class iter
 
template<typename K , typename V , class Ex , class H , class Eq >
class const_iter
 

Detailed Description

template<typename Key, typename Value, class Extract, class Hash, class Equal>
class utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >

Hashing based table.

This class is used as internal basis for all hashing based containers presented here. It is mainly insdpired on SGI STL implementation

Parameters
Keythe entry type for this table
ValueThe value type for cells in table
ExtractKey extractor from Value
Hashhashing functor for Key
Equalequality functor for Key
See also
utilmm::hash
Author
Frédéric Py fpy@l.nosp@m.aas..nosp@m.fr

Member Typedef Documentation

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef const_iter<Key, Value, Extract, Hash, Equal> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::const_iterator

const iterator type

The type used to iterate through this class without any modification

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef iter<Key, Value, Extract, Hash, Equal> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::iterator

iterator type

The type used to iterate through and manipulate this class

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef arg_traits<key_type>::type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::key_arg
template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef Key utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::key_type

Key type.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef size_t utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::size_type

Size type.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef arg_traits<value_type>::type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::value_arg
template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef Value utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::value_type

Value type for cells.

Constructor & Destructor Documentation

template<typename Key, typename Value, class Extract, class Hash, class Equal>
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::table ( )

Default constructor.

Create an empty table

template<typename Key, typename Value, class Extract, class Hash, class Equal>
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::table ( table< Key, Value, Extract, Hash, Equal > const &  )

Copy constructor.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::~table ( )

Copy destructor.

Member Function Documentation

template<typename Key, typename Value, class Extract, class Hash, class Equal>
iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::begin ( )

Beginning of table.

Returns
an iterator pointing to the beginning of the container
See also
end()

Referenced by utilmm::hash_set< Key, Hash, Equal >::begin(), and utilmm::hash_map< base_type *, size_t, hash_ptr< Ty, Hash >, eq_ptr< Ty, Equal > >::begin().

template<typename Key, typename Value, class Extract, class Hash, class Equal>
const_iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::begin ( ) const

Beginning of table.

Returns
a const iterator pointing to the beginning of the container
See also
end() const
template<typename Key, typename Value, class Extract, class Hash, class Equal>
void utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::clear ( )
template<typename Key, typename Value, class Extract, class Hash, class Equal>
bool utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::empty ( ) const

Emptyness test.

Return values
trueif this instance has no element
falseelse
See also
size() const

Referenced by utilmm::hash_set< Key, Hash, Equal >::empty(), and utilmm::hash_map< base_type *, size_t, hash_ptr< Ty, Hash >, eq_ptr< Ty, Equal > >::empty().

template<typename Key, typename Value, class Extract, class Hash, class Equal>
iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::end ( )

End of table.

Returns
an iterator pointing to the end of the container
See also
begin()

Referenced by utilmm::hash_set< Key, Hash, Equal >::end(), and utilmm::hash_map< base_type *, size_t, hash_ptr< Ty, Hash >, eq_ptr< Ty, Equal > >::end().

template<typename Key, typename Value, class Extract, class Hash, class Equal>
const_iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::end ( ) const

End of table.

Returns
a const iterator pointing to the end of the container
See also
begin() const
template<typename Key, typename Value, class Extract, class Hash, class Equal>
std::pair<iterator, iterator> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::equal_range ( key_arg  key)

equality range

Parameters
keya Key

This function tries to fuind all the elements of this table with a key equal to key

Returns
a pair where [first, second[ corresponds to all the elements whose key is equal to key

Referenced by utilmm::hash_set< Key, Hash, Equal >::find(), and utilmm::hash_map< base_type *, size_t, hash_ptr< Ty, Hash >, eq_ptr< Ty, Equal > >::find().

template<typename Key, typename Value, class Extract, class Hash, class Equal>
std::pair< const_iterator, const_iterator > utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::equal_range ( key_arg  key) const

equality range.

equality range

Parameters
keya Key

This function tries to fuind all the elements of this table with a key equal to key

Returns
a pair where [first, second[ corresponds to all the elements whose key is equal to key
template<typename Key, typename Value, class Extract, class Hash, class Equal>
void utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::erase ( iterator const &  first,
iterator const &  last 
)

Remove elements.

Parameters
firstan iterator
lastan iterator

removes all the element of the table in the range [first, last [

Referenced by utilmm::hash_set< Key, Hash, Equal >::erase(), and utilmm::hash_map< base_type *, size_t, hash_ptr< Ty, Hash >, eq_ptr< Ty, Equal > >::erase().

template<typename Key, typename Value, class Extract, class Hash, class Equal>
iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::insert_multiple ( value_arg  v)

multiple insertion

param v The value to insert

Thsi function insert v in table

Returns
an iterator pointing to the position where v was inserted
template<typename Key, typename Value, class Extract, class Hash, class Equal>
std::pair<iterator, bool> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::insert_unique ( value_arg  v)

Unique key insertion.

Parameters
vThe value to insert

This function tries to insert v in the table except if there's already an element whose keys is equal to the key of v

Returns
a pair where first is an iterator pointing to the element whose key is equal to the key of v and second is true if we have inserted v

Referenced by utilmm::hash_set< Key, Hash, Equal >::insert(), and utilmm::hash_map< base_type *, size_t, hash_ptr< Ty, Hash >, eq_ptr< Ty, Equal > >::insert().

template<typename Key, typename Value, class Extract, class Hash, class Equal>
size_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::max_size ( ) const
template<typename Key, typename Value, class Extract, class Hash, class Equal>
table& utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::operator= ( table< Key, Value, Extract, Hash, Equal > const &  other)

Copy operator.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
size_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::size ( ) const

element count

Returns
the number of element present in current container

Referenced by utilmm::hash_set< Key, Hash, Equal >::size(), and utilmm::hash_map< base_type *, size_t, hash_ptr< Ty, Hash >, eq_ptr< Ty, Equal > >::size().

template<typename Key, typename Value, class Extract, class Hash, class Equal>
void utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::swap ( table< Key, Value, Extract, Hash, Equal > &  other)

swapping values function

This function exchange the value of current instance with the value of another instance.

Parameters
otherThe other instance

Referenced by utilmm::hash_set< Key, Hash, Equal >::swap(), and utilmm::hash_map< base_type *, size_t, hash_ptr< Ty, Hash >, eq_ptr< Ty, Equal > >::swap().

Friends And Related Function Documentation

template<typename Key, typename Value, class Extract, class Hash, class Equal>
template<typename K , typename V , class Ex , class H , class Eq >
friend class const_iter
friend
template<typename Key, typename Value, class Extract, class Hash, class Equal>
template<typename K , typename V , class Ex , class H , class Eq >
friend class iter
friend

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

Generated on Mon Oct 8 2018 08:38:45 for Util-- by doxygen 1.8.11
SourceForge.net Project Page