Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# gslib::static_container::hash< Key, Value, Cont, KeyEqual > Class Template Reference

コンテナは std::pair< Key, Value > を格納可能でなければならない。 More...

`#include <hash.h>`

Inheritance diagram for gslib::static_container::hash< Key, Value, Cont, KeyEqual >:

[legend]
Collaboration diagram for gslib::static_container::hash< Key, Value, Cont, KeyEqual >:

[legend]
List of all members.

## Public Types
typedef std::pair< Key, Value > | pair_type
typedef Cont::iterator | iterator
typedef Cont::const_iterator | const_iterator
typedef boost::call_traits< KeyEqual >::param_type | key_equal
## Public Member Functions
| STATIC_CONTAINER_MEMBERTYPEDEF (pair_type)
| hash (key_equal equal=KeyEqual())
| hash (const Cont &cont, key_equal equal=KeyEqual())
iterator | begin ()
iterator | end ()
const_iterator | begin () const
const_iterator | end () const
const_iterator | find (typename boost::call_traits< Key >::param_type key) const
iterator | find (typename boost::call_traits< Key >::param_type key)
bool | empty () const
size_type | size () const
const Value & | search (typename boost::call_traits< Key >::param_type key) const
Value & | search (typename boost::call_traits< Key >::param_type key)
Value & | operator[] (typename boost::call_traits< Key >::param_type key)
| 単なる検索目的でむやみに使うと、挿入が何度も行われるので、使用には十分ご注意を。
std::pair< iterator, bool > | insert (const_reference v)
void | erase (iterator it)
void | clear ()
Cont & | get_container ()
| コンテナ取得
const Cont & | get_container () const
| コンテナ取得
## Private Member Functions
iterator | push_back (const_reference v)
## Private Attributes
Cont | cont_
KeyEqual | equal_

## Detailed Description

### template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
class gslib::static_container::hash< Key, Value, Cont, KeyEqual >

コンテナは std::pair< Key, Value > を格納可能でなければならない。

挿入、削除なども可能。

挿入は、コンテナの push_back() を使い実装されている。 削除は、コンテナの erase() を使い実装されている。 クリアは、コンテナの clear() を使い実装されている。

Definition at line 74 of file hash.h.

## Member Typedef Documentation

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
typedef Cont::const_iterator gslib::static_container::hash< Key, Value, Cont, KeyEqual >::const_iterator

| Reimplemented in gslib::static_container::list_hash< Key, Value, MaxSize, KeyEqual >. Definition at line 79 of file hash.h.

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
typedef Cont::iterator gslib::static_container::hash< Key, Value, Cont, KeyEqual >::iterator

| Reimplemented in gslib::static_container::list_hash< Key, Value, MaxSize, KeyEqual >. Definition at line 78 of file hash.h.

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
typedef boost::call_traits< KeyEqual >::param_type gslib::static_container::hash< Key, Value, Cont, KeyEqual >::key_equal

| Definition at line 80 of file hash.h. Referenced by gslib::static_container::hash< Key, Value, Cont, KeyEqual >::key_comp::key_comp().

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
typedef std::pair< Key, Value > gslib::static_container::hash< Key, Value, Cont, KeyEqual >::pair_type

| Definition at line 76 of file hash.h.

## Constructor & Destructor Documentation

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
gslib::static_container::hash< Key, Value, Cont, KeyEqual >::hash | ( | key_equal | equal = KeyEqual() | ) | `[inline]`

| Definition at line 103 of file hash.h.
    00103 : cont_(), equal_( equal ) {}

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
gslib::static_container::hash< Key, Value, Cont, KeyEqual >::hash | ( | const Cont & | cont,
|  | key_equal | equal = KeyEqual()
| ) | `[inline]`

| Definition at line 104 of file hash.h.
    00104 : cont_( cont ), equal_( equal ) {}

## Member Function Documentation

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
const_iterator gslib::static_container::hash< Key, Value, Cont, KeyEqual >::begin | ( |  | ) | const`[inline]`

| Definition at line 114 of file hash.h.
    00114                                          {
    00115                 return cont_.begin();
    00116             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
iterator gslib::static_container::hash< Key, Value, Cont, KeyEqual >::begin | ( |  | ) | `[inline]`

| Definition at line 106 of file hash.h. Referenced by gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::empty(), gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::find(), and gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::size().
    00106                              {
    00107                 return cont_.begin();
    00108             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
void gslib::static_container::hash< Key, Value, Cont, KeyEqual >::clear | ( |  | ) | `[inline]`

| Definition at line 180 of file hash.h.
    00180                          {
    00181                 cont_.clear();
    00182             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
bool gslib::static_container::hash< Key, Value, Cont, KeyEqual >::empty | ( |  | ) | const`[inline]`

| Definition at line 130 of file hash.h.
    00130                                {
    00131                 return begin() == end();
    00132             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
const_iterator gslib::static_container::hash< Key, Value, Cont, KeyEqual >::end | ( |  | ) | const`[inline]`

| Definition at line 118 of file hash.h.
    00118                                        {
    00119                 return cont_.end();
    00120             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
iterator gslib::static_container::hash< Key, Value, Cont, KeyEqual >::end | ( |  | ) | `[inline]`

| Definition at line 110 of file hash.h. Referenced by gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::empty(), gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::find(), gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::insert(), gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::operator[](), gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::push_back(), and gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::size().
    00110                            {
    00111                 return cont_.end();
    00112             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
void gslib::static_container::hash< Key, Value, Cont, KeyEqual >::erase | ( | iterator | it | ) | `[inline]`

| Definition at line 177 of file hash.h.
    00177                                       {
    00178                 cont_.erase( it );
    00179             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
iterator gslib::static_container::hash< Key, Value, Cont, KeyEqual >::find | ( | typename boost::call_traits< Key >::param_type | key | ) | `[inline]`

| Definition at line 126 of file hash.h.
    00126                                                                             {
    00127                 return find_if( begin(), end(), key_comp( key, equal_ ) );
    00128             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
const_iterator gslib::static_container::hash< Key, Value, Cont, KeyEqual >::find | ( | typename boost::call_traits< Key >::param_type | key | ) | const`[inline]`

| Definition at line 122 of file hash.h. Referenced by gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::insert(), gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::operator[](), and gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::search().
    00122                                                                                         {
    00123                 return find_if( begin(), end(), key_comp( key, equal_ ) );
    00124             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
const Cont& gslib::static_container::hash< Key, Value, Cont, KeyEqual >::get_container | ( |  | ) | const`[inline]`

| コンテナ取得 Definition at line 190 of file hash.h.
    00190                                               {
    00191                 return cont_;
    00192             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
Cont& gslib::static_container::hash< Key, Value, Cont, KeyEqual >::get_container | ( |  | ) | `[inline]`

| コンテナ取得 Definition at line 185 of file hash.h.
    00185                                   {
    00186                 return cont_;
    00187             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
std::pair< iterator, bool > gslib::static_container::hash< Key, Value, Cont, KeyEqual >::insert | ( | const_reference | v | ) | `[inline]`

| Returns: first が、挿入後のイテレーター。second が挿入作業の有無を示す bool からなる pair を返す Definition at line 163 of file hash.h.
    00163                                                                   {
    00164                 iterator it = find( v.first );
    00165                 if ( it != end() ) {
    00166                     //  すでに同じキーのペアが存在したので、それを返す
    00167                     return std::make_pair(
    00168                         it,
    00169                         false );
    00170                 } else {
    00171                     //  存在しなかったので挿入
    00172                     return std::make_pair(
    00173                         push_back( v ),
    00174                         false );
    00175                 }
    00176             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
Value& gslib::static_container::hash< Key, Value, Cont, KeyEqual >::operator[] | ( | typename boost::call_traits< Key >::param_type | key | ) | `[inline]`

| 単なる検索目的でむやみに使うと、挿入が何度も行われるので、使用には十分ご注意を。 Definition at line 150 of file hash.h.
    00150                                                                                   {
    00151                 iterator it = find( key );
    00152                 if ( it != end() ) {
    00153                     return it->second;
    00154                 } else {
    00155                     return push_back( value_type( key, Value() ) )->second;
    00156                 }
    00157             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
iterator gslib::static_container::hash< Key, Value, Cont, KeyEqual >::push_back | ( | const_reference | v | ) | `[inline, private]`

| Definition at line 96 of file hash.h. Referenced by gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::insert(), and gslib::static_container::hash< Key, Value, list< std::pair< Key, Value >, MaxSize >, KeyEqual >::operator[]().
    00096                                                     {
    00097                 cont_.push_back( v );
    00098                 iterator it = end();
    00099                 --it;
    00100                 return it;
    00101             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
Value& gslib::static_container::hash< Key, Value, Cont, KeyEqual >::search | ( | typename boost::call_traits< Key >::param_type | key | ) | `[inline]`

| Definition at line 142 of file hash.h.
    00142                                                                             {
    00143                 return find( key )->second;
    00144             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
const Value& gslib::static_container::hash< Key, Value, Cont, KeyEqual >::search | ( | typename boost::call_traits< Key >::param_type | key | ) | const`[inline]`

| Definition at line 138 of file hash.h.
    00138                                                                                         {
    00139                 return find( key )->second;
    00140             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
size_type gslib::static_container::hash< Key, Value, Cont, KeyEqual >::size | ( |  | ) | const`[inline]`

| Definition at line 134 of file hash.h.
    00134                                    {
    00135                 return std::distance( begin(), end() );
    00136             }

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
gslib::static_container::hash< Key, Value, Cont, KeyEqual >::STATIC_CONTAINER_MEMBERTYPEDEF | ( | pair_type |  | ) |

## Member Data Documentation

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
Cont gslib::static_container::hash< Key, Value, Cont, KeyEqual >::cont_`[private]`

| Definition at line 83 of file hash.h.

template<typename Key, typename Value, typename Cont, typename KeyEqual = std::equal_to< Key >>
KeyEqual gslib::static_container::hash< Key, Value, Cont, KeyEqual >::equal_`[private]`

| Definition at line 84 of file hash.h.

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

- hash.h