epoc32/include/stdapis/stlport/stl/_hashtable.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /*
     2  *
     3  * Copyright (c) 1994
     4  * Hewlett-Packard Company
     5  *
     6  * Copyright (c) 1996,1997
     7  * Silicon Graphics Computer Systems, Inc.
     8  *
     9  * Copyright (c) 1997
    10  * Moscow Center for SPARC Technology
    11  *
    12  * Copyright (c) 1999 
    13  * Boris Fomitchev
    14  *
    15  * This material is provided "as is", with absolutely no warranty expressed
    16  * or implied. Any use is at your own risk.
    17  *
    18  * Permission to use or copy this software for any purpose is hereby granted 
    19  * without fee, provided the above notices are retained on all copies.
    20  * Permission to modify the code and to distribute modified code is granted,
    21  * provided the above notices are retained, and a notice that the code was
    22  * modified is included with the above copyright notice.
    23  *
    24  */
    25 
    26 /* NOTE: This is an internal header file, included by other STL headers.
    27  *   You should not attempt to use it directly.
    28  */
    29 
    30 #ifndef _STLP_INTERNAL_HASHTABLE_H
    31 #define _STLP_INTERNAL_HASHTABLE_H
    32 
    33 # ifndef _STLP_INTERNAL_VECTOR_H
    34 #  include <stl/_vector.h>
    35 # endif
    36 
    37 # ifndef _STLP_INTERNAL_ITERATOR_H
    38 #  include <stl/_iterator.h>
    39 # endif
    40 
    41 # ifndef _STLP_INTERNAL_FUNCTION_H
    42 #  include <stl/_function_base.h>
    43 # endif
    44 
    45 # ifndef _STLP_INTERNAL_ALGOBASE_H
    46 #  include <stl/_algobase.h>
    47 # endif
    48 
    49 # ifndef _STLP_HASH_FUN_H
    50 #  include <stl/_hash_fun.h>
    51 # endif
    52 
    53 // Hashtable class, used to implement the hashed associative containers
    54 // hash_set, hash_map, hash_multiset, and hash_multimap.
    55 
    56 #ifdef _STLP_DEBUG
    57 #  define hashtable __WORKAROUND_DBG_RENAME(hashtable)
    58 #endif
    59 
    60 _STLP_BEGIN_NAMESPACE
    61 
    62 template <class _Val>
    63 struct _Hashtable_node
    64 {
    65   typedef _Hashtable_node<_Val> _Self;
    66   _Self* _M_next;
    67   _Val _M_val;
    68   __TRIVIAL_STUFF(_Hashtable_node)
    69 };  
    70 
    71 // some compilers require the names of template parameters to be the same
    72 template <class _Val, class _Key, class _HF,
    73           class _ExK, class _EqK, class _All>
    74 class hashtable;
    75 
    76 template <class _Val, class _Key, class _HF,
    77           class _ExK, class _EqK, class _All>
    78 struct _Hashtable_iterator
    79 {
    80   typedef hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>
    81           _Hashtable;
    82   typedef _Hashtable_node<_Val> _Node;
    83 
    84   _Node* _M_cur;
    85   _Hashtable* _M_ht;
    86 
    87   _Hashtable_iterator(_Node* __n, _Hashtable* __tab) 
    88     : _M_cur(__n), _M_ht(__tab) {}
    89   _Hashtable_iterator() {}
    90 
    91   _Node* _M_skip_to_next();
    92 };
    93 
    94 
    95 template <class _Val, class _Traits, class _Key, class _HF,
    96           class _ExK, class _EqK, class _All>
    97 struct _Ht_iterator : public _Hashtable_iterator< _Val, _Key,_HF, _ExK,_EqK,_All>
    98 {
    99   
   100   typedef _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All> _Base;
   101 
   102   //  typedef _Ht_iterator<_Val, _Nonconst_traits<_Val>,_Key,_HF,_ExK,_EqK,_All> iterator;
   103   //  typedef _Ht_iterator<_Val, _Const_traits<_Val>,_Key,_HF,_ExK,_EqK,_All> const_iterator;
   104   typedef _Ht_iterator<_Val, _Traits,_Key,_HF,_ExK,_EqK,_All> _Self;
   105 
   106   typedef hashtable<_Val,_Key,_HF,_ExK,_EqK,_All> _Hashtable;
   107   typedef _Hashtable_node<_Val> _Node;
   108 
   109   typedef _Val value_type;
   110   typedef forward_iterator_tag iterator_category;
   111   typedef ptrdiff_t difference_type;
   112   typedef size_t size_type;
   113   typedef typename _Traits::reference reference;
   114   typedef typename _Traits::pointer   pointer;
   115 
   116   _Ht_iterator(const _Node* __n, const _Hashtable* __tab) :
   117     _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>((_Node*)__n, (_Hashtable*)__tab) {}
   118   _Ht_iterator() {}
   119   _Ht_iterator(const _Ht_iterator<_Val, _Nonconst_traits<_Val>,_Key,_HF,_ExK,_EqK,_All>& __it) : 
   120     _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>(__it) {}
   121 
   122   reference operator*() const { 
   123       return this->_M_cur->_M_val; 
   124   }
   125   _STLP_DEFINE_ARROW_OPERATOR
   126 
   127   _Self& operator++() {
   128     _Node* __n = this->_M_cur->_M_next;
   129     this->_M_cur =  (__n !=0 ? __n : this->_M_skip_to_next());
   130     return *this;
   131   }
   132   inline  _Self operator++(int) {
   133      _Self __tmp = *this;
   134     ++*this;
   135     return __tmp;
   136   }
   137 };
   138 
   139 template <class _Val, class _Traits, class _Traits1, class _Key, class _HF,
   140           class _ExK, class _EqK, class _All>
   141 inline bool 
   142 operator==(const _Ht_iterator<_Val, _Traits,_Key,_HF,_ExK,_EqK,_All>& __x, 
   143 	   const _Ht_iterator<_Val, _Traits1,_Key,_HF,_ExK,_EqK,_All>& __y) { 
   144   return __x._M_cur == __y._M_cur; 
   145 }
   146 
   147 #ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
   148 template <class _Val, class _Key, class _HF,
   149           class _ExK, class _EqK, class _All>
   150 inline bool 
   151 operator!=(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>& __x, 
   152 	   const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>& __y) { 
   153   return __x._M_cur != __y._M_cur; 
   154 }
   155 #else
   156 
   157 # if (defined (__GNUC__) && (__GNUC_MINOR__ < 8))
   158 template <class _Val, class _Key, class _HF,
   159           class _ExK, class _EqK, class _All>
   160 inline bool
   161 operator!=(const _Ht_iterator<_Val, _Const_traits<_Val>,_Key,_HF,_ExK,_EqK,_All>& __x,
   162            const _Ht_iterator<_Val, _Nonconst_traits<_Val>,_Key,_HF,_ExK,_EqK,_All>& __y) {
   163   return __x._M_cur != __y._M_cur;
   164 }
   165 # endif
   166 
   167 template <class _Val, class _Key, class _HF,
   168           class _ExK, class _EqK, class _All>
   169 inline bool 
   170 operator!=(const _Ht_iterator<_Val, _Nonconst_traits<_Val>,_Key,_HF,_ExK,_EqK,_All>& __x, 
   171 	   const _Ht_iterator<_Val, _Const_traits<_Val>,_Key,_HF,_ExK,_EqK,_All>& __y) { 
   172   return __x._M_cur != __y._M_cur; 
   173 }
   174 #endif
   175 
   176 # ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
   177 template <class _Val, class _Traits, class _Key, class _HF, class _ExK, class _EqK, class _All>
   178 inline _Val* value_type(const _Ht_iterator<_Val, _Traits,_Key,_HF,_ExK,_EqK,_All>&) { return (_Val*) 0; }
   179 template <class _Val, class _Traits, class _Key, class _HF, class _ExK, class _EqK, class _All>
   180 inline forward_iterator_tag iterator_category(const _Ht_iterator<_Val, _Traits,_Key,_HF,_ExK,_EqK,_All>&) { return forward_iterator_tag(); }
   181 template <class _Val, class _Traits, class _Key, class _HF, class _ExK, class _EqK, class _All>
   182 inline ptrdiff_t* distance_type(const _Ht_iterator<_Val,_Traits,_Key,_HF,_ExK,_EqK,_All>&) { return (ptrdiff_t*) 0; }
   183 #endif
   184 
   185 #define __stl_num_primes  28
   186 template <class _Tp>
   187 class _Stl_prime {
   188 public:
   189   static const size_t _M_list[__stl_num_primes];
   190 };
   191 
   192 # if defined (_STLP_USE_TEMPLATE_EXPORT) 
   193 _STLP_EXPORT_TEMPLATE_CLASS _Stl_prime<bool>;
   194 # endif
   195 
   196 typedef _Stl_prime<bool> _Stl_prime_type;
   197 
   198 
   199 // Hashtables handle allocators a bit differently than other containers
   200 //  do.  If we're using standard-conforming allocators, then a hashtable
   201 //  unconditionally has a member variable to hold its allocator, even if
   202 //  it so happens that all instances of the allocator type are identical.
   203 // This is because, for hashtables, this extra storage is negligible.  
   204 //  Additionally, a base class wouldn't serve any other purposes; it 
   205 //  wouldn't, for example, simplify the exception-handling code.
   206 template <class _Val, class _Key, class _HF,
   207           class _ExK, class _EqK, class _All>
   208 class hashtable 
   209 {
   210   typedef hashtable<_Val, _Key, _HF, _ExK, _EqK, _All> _Self;
   211 public:
   212   typedef _Key key_type;
   213   typedef _Val value_type;
   214   typedef _HF hasher;
   215   typedef _EqK key_equal;
   216 
   217   typedef size_t            size_type;
   218   typedef ptrdiff_t         difference_type;
   219   typedef value_type*       pointer;
   220   typedef const value_type* const_pointer;
   221   typedef value_type&       reference;
   222   typedef const value_type& const_reference;
   223   typedef forward_iterator_tag _Iterator_category;
   224 
   225   hasher hash_funct() const { return _M_hash; }
   226   key_equal key_eq() const { return _M_equals; }
   227 
   228 private:
   229   typedef _Hashtable_node<_Val> _Node;
   230 
   231 private:
   232   _STLP_FORCE_ALLOCATORS(_Val, _All)
   233   typedef typename _Alloc_traits<_Node, _All>::allocator_type _M_node_allocator_type;
   234   typedef typename _Alloc_traits<void*, _All>::allocator_type _M_node_ptr_allocator_type;
   235   typedef __vector__<void*, _M_node_ptr_allocator_type> _BucketVector;
   236 public:
   237   typedef typename _Alloc_traits<_Val,_All>::allocator_type allocator_type;
   238   allocator_type get_allocator() const { 
   239     return _STLP_CONVERT_ALLOCATOR((const _M_node_allocator_type&)_M_num_elements, _Val); 
   240   }
   241 private:
   242   hasher                _M_hash;
   243   key_equal             _M_equals;
   244   _ExK                  _M_get_key;
   245   _BucketVector         _M_buckets;
   246   _STLP_alloc_proxy<size_type, _Node, _M_node_allocator_type>  _M_num_elements;
   247   const _Node* _M_get_bucket(size_t __n) const { return (_Node*)_M_buckets[__n]; }
   248 
   249 public:
   250   typedef _Const_traits<_Val> __const_val_traits;
   251   typedef _Nonconst_traits<_Val> __nonconst_val_traits;
   252   typedef _Ht_iterator<_Val, __const_val_traits,_Key,_HF,_ExK,_EqK, _All> const_iterator;
   253   typedef _Ht_iterator<_Val, __nonconst_val_traits,_Key,_HF,_ExK,_EqK,_All> iterator;
   254   friend struct _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>;
   255   friend struct _Ht_iterator<_Val, _Nonconst_traits<_Val>,_Key,_HF,_ExK,_EqK,_All>;
   256   friend struct _Ht_iterator<_Val, _Const_traits<_Val>,_Key,_HF,_ExK,_EqK, _All>;
   257 
   258 public:
   259   hashtable(size_type __n,
   260             const _HF&  __hf,
   261             const _EqK& __eql,
   262             const _ExK& __ext,
   263             const allocator_type& __a = allocator_type())
   264     :
   265       _M_hash(__hf),
   266       _M_equals(__eql),
   267       _M_get_key(__ext),
   268       _M_buckets(_STLP_CONVERT_ALLOCATOR(__a,void*)),
   269       _M_num_elements(_STLP_CONVERT_ALLOCATOR(__a,_Node), (size_type)0)
   270   {
   271     _M_initialize_buckets(__n);
   272   }
   273 
   274   hashtable(size_type __n,
   275             const _HF&    __hf = hasher(),
   276             const _EqK&   __eql = key_equal(),
   277             const allocator_type& __a = allocator_type())
   278     :
   279       _M_hash(__hf),
   280       _M_equals(__eql),
   281       _M_get_key(_ExK()),
   282       _M_buckets(_STLP_CONVERT_ALLOCATOR(__a,void*)),
   283       _M_num_elements(_STLP_CONVERT_ALLOCATOR(__a,_Node), (size_type)0)
   284   {
   285     _M_initialize_buckets(__n);
   286   }
   287 
   288   hashtable(const _Self& __ht)
   289     :
   290       _M_hash(__ht._M_hash),
   291       _M_equals(__ht._M_equals),
   292       _M_get_key(__ht._M_get_key),
   293       _M_buckets(_STLP_CONVERT_ALLOCATOR(__ht.get_allocator(),void*)),
   294       _M_num_elements((const _M_node_allocator_type&)__ht._M_num_elements, (size_type)0)
   295   {
   296     _M_copy_from(__ht);
   297   }
   298 
   299   _Self& operator= (const _Self& __ht)
   300   {
   301     if (&__ht != this) {
   302       clear();
   303       _M_hash = __ht._M_hash;
   304       _M_equals = __ht._M_equals;
   305       _M_get_key = __ht._M_get_key;
   306       _M_copy_from(__ht);
   307     }
   308     return *this;
   309   }
   310 
   311   ~hashtable() { clear(); }
   312 
   313   size_type size() const { return _M_num_elements._M_data; }
   314   size_type max_size() const { return size_type(-1); }
   315   bool empty() const { return size() == 0; }
   316 
   317   void swap(_Self& __ht)
   318   {
   319     _STLP_STD::swap(_M_hash, __ht._M_hash);
   320     _STLP_STD::swap(_M_equals, __ht._M_equals);
   321     _STLP_STD::swap(_M_get_key, __ht._M_get_key);
   322     _M_buckets.swap(__ht._M_buckets);
   323     _STLP_STD::swap(_M_num_elements, __ht._M_num_elements);
   324   }
   325 
   326   iterator begin()
   327   { 
   328     for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
   329       if (_M_buckets[__n])
   330         return iterator((_Node*)_M_buckets[__n], this);
   331     return end();
   332   }
   333 
   334   iterator end() { return iterator((_Node*)0, this); }
   335 
   336   const_iterator begin() const
   337   {
   338     for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
   339       if (_M_buckets[__n])
   340         return const_iterator((_Node*)_M_buckets[__n], this);
   341     return end();
   342   }
   343 
   344   const_iterator end() const { return const_iterator((_Node*)0, this); }
   345 
   346   static bool _STLP_CALL _M_equal (const hashtable<_Val, _Key, _HF, _ExK, _EqK, _All>&,
   347 			const hashtable<_Val, _Key, _HF, _ExK, _EqK, _All>&);
   348 
   349 public:
   350 
   351   size_type bucket_count() const { return _M_buckets.size(); }
   352 
   353   size_type max_bucket_count() const
   354     { return _Stl_prime_type::_M_list[(int)__stl_num_primes - 1]; } 
   355 
   356   size_type elems_in_bucket(size_type __bucket) const
   357   {
   358     size_type __result = 0;
   359     for (_Node* __cur = (_Node*)_M_buckets[__bucket]; __cur; __cur = __cur->_M_next)
   360       __result += 1;
   361     return __result;
   362   }
   363 
   364   pair<iterator, bool> insert_unique(const value_type& __obj)
   365   {
   366     resize(_M_num_elements._M_data + 1);
   367     return insert_unique_noresize(__obj);
   368   }
   369 
   370   iterator insert_equal(const value_type& __obj)
   371   {
   372     resize(_M_num_elements._M_data + 1);
   373     return insert_equal_noresize(__obj);
   374   }
   375 
   376   pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
   377   iterator insert_equal_noresize(const value_type& __obj);
   378  
   379 #ifdef _STLP_MEMBER_TEMPLATES
   380   template <class _InputIterator>
   381   void insert_unique(_InputIterator __f, _InputIterator __l)
   382   {
   383     insert_unique(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator));
   384   }
   385 
   386   template <class _InputIterator>
   387   void insert_equal(_InputIterator __f, _InputIterator __l)
   388   {
   389     insert_equal(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator));
   390   }
   391 
   392   template <class _InputIterator>
   393   void insert_unique(_InputIterator __f, _InputIterator __l,
   394                      const input_iterator_tag &)
   395   {
   396     for ( ; __f != __l; ++__f)
   397       insert_unique(*__f);
   398   }
   399 
   400   template <class _InputIterator>
   401   void insert_equal(_InputIterator __f, _InputIterator __l,
   402                     const input_iterator_tag &)
   403   {
   404     for ( ; __f != __l; ++__f)
   405       insert_equal(*__f);
   406   }
   407 
   408   template <class _ForwardIterator>
   409   void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
   410                      const forward_iterator_tag &)
   411   {
   412     size_type __n = distance(__f, __l);
   413     resize(_M_num_elements._M_data + __n);
   414     for ( ; __n > 0; --__n, ++__f)
   415       insert_unique_noresize(*__f);
   416   }
   417 
   418   template <class _ForwardIterator>
   419   void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
   420                     const forward_iterator_tag &)
   421   {
   422     size_type __n = distance(__f, __l);
   423     resize(_M_num_elements._M_data + __n);
   424     for ( ; __n > 0; --__n, ++__f)
   425       insert_equal_noresize(*__f);
   426   }
   427 
   428 #else /* _STLP_MEMBER_TEMPLATES */
   429   void insert_unique(const value_type* __f, const value_type* __l)
   430   {
   431     size_type __n = __l - __f;
   432     resize(_M_num_elements._M_data + __n);
   433     for ( ; __n > 0; --__n, ++__f)
   434       insert_unique_noresize(*__f);
   435   }
   436 
   437   void insert_equal(const value_type* __f, const value_type* __l)
   438   {
   439     size_type __n = __l - __f;
   440     resize(_M_num_elements._M_data + __n);
   441     for ( ; __n > 0; --__n, ++__f)
   442       insert_equal_noresize(*__f);
   443   }
   444 
   445   void insert_unique(const_iterator __f, const_iterator __l)
   446   {
   447     size_type __n = distance(__f, __l);
   448     resize(_M_num_elements._M_data + __n);
   449     for ( ; __n > 0; --__n, ++__f)
   450       insert_unique_noresize(*__f);
   451   }
   452 
   453   void insert_equal(const_iterator __f, const_iterator __l)
   454   {
   455     size_type __n = distance(__f, __l);
   456     resize(_M_num_elements._M_data + __n);
   457     for ( ; __n > 0; --__n, ++__f)
   458       insert_equal_noresize(*__f);
   459   }
   460 #endif /*_STLP_MEMBER_TEMPLATES */
   461 
   462   reference find_or_insert(const value_type& __obj);
   463 
   464 private:
   465 # if defined(_STLP_MEMBER_TEMPLATES) && ! defined ( _STLP_NO_EXTENSIONS )  && !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC_)))
   466   template <class _KT> 
   467    _Node* _M_find(const _KT& __key) const
   468 # else
   469    _Node* _M_find(const key_type& __key) const
   470 # endif
   471   {
   472     size_type __n = _M_hash(__key)% _M_buckets.size();
   473     _Node* __first;
   474     for ( __first = (_Node*)_M_buckets[__n];
   475           __first && !_M_equals(_M_get_key(__first->_M_val), __key);
   476           __first = __first->_M_next)
   477       {}
   478     return __first;
   479   } 
   480 
   481 public:
   482 # if defined(_STLP_MEMBER_TEMPLATES) && ! defined ( _STLP_NO_EXTENSIONS )  && !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__)))
   483   template <class _KT> 
   484   iterator find(const _KT& __key) 
   485 # else
   486   iterator find(const key_type& __key) 
   487 # endif
   488   {
   489     return iterator(_M_find(__key), this);
   490   } 
   491 
   492 # if defined(_STLP_MEMBER_TEMPLATES) && ! defined ( _STLP_NO_EXTENSIONS )  && !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__)))
   493   template <class _KT> 
   494   const_iterator find(const _KT& __key) const
   495 # else
   496   const_iterator find(const key_type& __key) const
   497 # endif
   498   {
   499     return const_iterator(_M_find(__key), this);
   500   } 
   501 
   502   size_type count(const key_type& __key) const
   503   {
   504     const size_type __n = _M_bkt_num_key(__key);
   505     size_type __result = 0;
   506 
   507     for (const _Node* __cur = (_Node*)_M_buckets[__n]; __cur; __cur = __cur->_M_next)
   508       if (_M_equals(_M_get_key(__cur->_M_val), __key))
   509         ++__result;
   510     return __result;
   511   }
   512 
   513   pair<iterator, iterator> 
   514   equal_range(const key_type& __key);
   515 
   516   pair<const_iterator, const_iterator> 
   517   equal_range(const key_type& __key) const;
   518 
   519   size_type erase(const key_type& __key);
   520   //   void erase(const iterator& __it); `
   521   void erase(const const_iterator& __it) ;
   522 
   523   //  void erase(const const_iterator& __first, const const_iterator __last) {
   524   //     erase((const iterator&)__first, (const iterator&)__last);
   525   //  }
   526   void erase(const_iterator __first, const_iterator __last);
   527   void resize(size_type __num_elements_hint);
   528   void clear();
   529 
   530 public:
   531   // this is for hash_map::operator[]
   532   reference _M_insert(const value_type& __obj);
   533 
   534 private:
   535 
   536   size_type _M_next_size(size_type __n) const;
   537 
   538   void _M_initialize_buckets(size_type __n)
   539   {
   540     const size_type __n_buckets = _M_next_size(__n);
   541     _M_buckets.reserve(__n_buckets);
   542     _M_buckets.insert(_M_buckets.end(), __n_buckets, (void*) 0);
   543     _M_num_elements._M_data = 0;
   544   }
   545 
   546   size_type _M_bkt_num_key(const key_type& __key) const
   547   {
   548     return _M_bkt_num_key(__key, _M_buckets.size());
   549   }
   550 
   551   size_type _M_bkt_num(const value_type& __obj) const
   552   {
   553     return _M_bkt_num_key(_M_get_key(__obj));
   554   }
   555 
   556   size_type _M_bkt_num_key(const key_type& __key, size_t __n) const
   557   {
   558     return _M_hash(__key) % __n;
   559   }
   560 
   561   size_type _M_bkt_num(const value_type& __obj, size_t __n) const
   562   {
   563     return _M_bkt_num_key(_M_get_key(__obj), __n);
   564   }
   565 
   566   _Node* _M_new_node(const value_type& __obj)
   567   {
   568     _Node* __n = _M_num_elements.allocate(1);
   569     __n->_M_next = 0;
   570     _STLP_TRY {
   571       _Construct(&__n->_M_val, __obj);
   572       //      return __n;
   573     }
   574     _STLP_UNWIND(_M_num_elements.deallocate(__n, 1));
   575     return __n;
   576   }
   577   
   578   void _M_delete_node(_Node* __n)
   579   {
   580     _STLP_STD::_Destroy(&__n->_M_val);
   581     _M_num_elements.deallocate(__n, 1);
   582   }
   583 
   584   void _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last);
   585   void _M_erase_bucket(const size_type __n, _Node* __last);
   586 
   587   void _M_copy_from(const _Self& __ht);
   588 };
   589 
   590 #define _STLP_TEMPLATE_HEADER template <class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All>
   591 #define _STLP_TEMPLATE_CONTAINER hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>
   592 #include <stl/_relops_hash_cont.h>
   593 #undef _STLP_TEMPLATE_CONTAINER
   594 #undef _STLP_TEMPLATE_HEADER
   595 
   596 _STLP_END_NAMESPACE
   597 
   598 # undef hashtable
   599 
   600 # if !defined (_STLP_LINK_TIME_INSTANTIATION)
   601 #  include <stl/_hashtable.c>
   602 # endif
   603 
   604 # if defined (_STLP_DEBUG)
   605 #  include <stl/debug/_hashtable.h>
   606 # endif
   607 
   608 #endif /* _STLP_INTERNAL_HASHTABLE_H */
   609 
   610 // Local Variables:
   611 // mode:C++
   612 // End:
   613 
   614