home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / stlport / stl / wrappers / _hash_set.h < prev    next >
C/C++ Source or Header  |  2001-11-14  |  6KB  |  151 lines

  1. /*
  2.  * Copyright (c) 1999, 2000
  3.  * Boris Fomitchev
  4.  *
  5.  * This material is provided "as is", with absolutely no warranty expressed
  6.  * or implied. Any use is at your own risk.
  7.  *
  8.  * Permission to use or copy this software for any purpose is hereby granted 
  9.  * without fee, provided the above notices are retained on all copies.
  10.  * Permission to modify the code and to distribute modified code is granted,
  11.  * provided the above notices are retained, and a notice that the code was
  12.  * modified is included with the above copyright notice.
  13.  *
  14.  */
  15.  
  16. /* NOTE: This is an internal header file, included by other STL headers.
  17.  *   You should not attempt to use it directly.
  18.  */
  19.  
  20. #ifndef _STLP_INTERNAL_WRAP_HASH_SET_H
  21. #define _STLP_INTERNAL_WRAP_HASH_SET_H
  22.  
  23. #ifndef _STLP_INTERNAL_HASH_SET_H
  24. # include <stl/_hash_set.h>
  25. #endif
  26.  
  27. # ifdef _STLP_USE_NAMESPACES
  28. namespace STLPORT { 
  29. # endif
  30.  
  31. #  if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
  32. #   define __HS_TEMPLATE_HEADER  template <class _Value>
  33. #   define __HS_ARGUMENTS        _Value
  34. #   define __HS_BASE_ARGUMENTS   _Value, hash<_Value>, equal_to<_Value>, _STLP_DEFAULT_ALLOCATOR(_Value)
  35. #  else
  36. #   define __HS_TEMPLATE_HEADER  template <class _Value, class _HashFcn, class _EqualKey >
  37. #   define __HS_ARGUMENTS        _Value, _HashFcn, _EqualKey
  38. #   define __HS_BASE_ARGUMENTS   _Value, _HashFcn, _EqualKey, _STLP_DEFAULT_ALLOCATOR(_Value)
  39. #  endif
  40.  
  41.  
  42. #  define __HS_SUPER  __hash_set< __HS_BASE_ARGUMENTS >
  43. #  define __HMS_SUPER __hash_multiset< __HS_BASE_ARGUMENTS >
  44.  
  45.  
  46. // provide a "default" hash_set adaptor
  47. __HS_TEMPLATE_HEADER
  48. class hash_set : public __HS_SUPER 
  49. {
  50.   typedef hash_set< __HS_ARGUMENTS > _Self;
  51. public:
  52.   typedef  __HS_SUPER _Super;
  53.   __IMPORT_WITH_ITERATORS(_Super)
  54.   typedef typename _Super::key_type key_type;
  55.   typedef typename _Super::hasher hasher;
  56.   typedef typename _Super::key_equal key_equal;
  57.   hash_set() {}
  58.   hash_set(size_type n) : __HS_SUPER(n) {}
  59.   hash_set(size_type n, const hasher& hf) : __HS_SUPER(n, hf) {}
  60.   hash_set(size_type n, const hasher& hf, const key_equal& eql): __HS_SUPER(n, hf, eql) {}
  61.  
  62.   hash_set(const value_type* f, const value_type* l) : __HS_SUPER(f,l) {}
  63.   hash_set(const value_type* f, const value_type* l, size_type n): __HS_SUPER(f,l,n) {}
  64.   hash_set(const value_type* f, const value_type* l, size_type n,
  65.            const hasher& hf) : __HS_SUPER(f,l,n,hf) {}
  66.   hash_set(const value_type* f, const value_type* l, size_type n,
  67.            const hasher& hf, const key_equal& eql) : __HS_SUPER(f,l,n,hf, eql) {}
  68.  
  69.   hash_set(const_iterator f, const_iterator l) : __HS_SUPER(f,l) { }
  70.   hash_set(const_iterator f, const_iterator l, size_type n) : __HS_SUPER(f,l,n) { }
  71.   hash_set(const_iterator f, const_iterator l, size_type n,
  72.            const hasher& hf) : __HS_SUPER(f, l, n, hf) { }
  73.   hash_set(const_iterator f, const_iterator l, size_type n,
  74.            const hasher& hf, const key_equal& eql) : __HS_SUPER(f, l, n, hf, eql) { }
  75. # if defined (_STLP_BASE_MATCH_BUG)
  76.     friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& hs1, const _Self& hs2);
  77. # endif
  78. };
  79.  
  80. # if defined (_STLP_BASE_MATCH_BUG)
  81. __HS_TEMPLATE_HEADER
  82. inline bool operator==(const hash_set< __HS_ARGUMENTS >& hs1, 
  83.                        const hash_set< __HS_ARGUMENTS >& hs2)
  84. {
  85.     typedef __HS_SUPER _Super;
  86.     return (const _Super&)hs1 == (const _Super&)hs2; 
  87. }
  88. # endif
  89.  
  90. // provide a "default" hash_multiset adaptor
  91. __HS_TEMPLATE_HEADER
  92. class hash_multiset : public __HMS_SUPER
  93. {
  94.   typedef hash_multiset< __HS_ARGUMENTS > _Self;
  95. public:
  96.   typedef __HMS_SUPER _Super;
  97.   __IMPORT_WITH_ITERATORS(_Super)
  98.   typedef typename _Super::key_type key_type;
  99.   typedef typename _Super::hasher hasher;
  100.   typedef typename _Super::key_equal key_equal;
  101.  
  102.   hash_multiset() {}
  103.   hash_multiset(size_type __n) : __HMS_SUPER(__n) {}
  104.   hash_multiset(size_type __n, const hasher& __hf) : __HMS_SUPER(__n, __hf) {}
  105.   hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql): __HMS_SUPER(__n, __hf, __eql) {}
  106.  
  107.   hash_multiset(const value_type* __f, const value_type* __l) : __HMS_SUPER(__f,__l) {}
  108.   hash_multiset(const value_type* __f, const value_type* __l, size_type __n): __HMS_SUPER(__f,__l,__n) {}
  109.   hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
  110.            const hasher& __hf) : __HMS_SUPER(__f,__l,__n,__hf) {}
  111.   hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
  112.            const hasher& __hf, const key_equal& __eql) : __HMS_SUPER(__f,__l,__n,__hf, __eql) {}
  113.  
  114.   hash_multiset(const_iterator __f, const_iterator __l) : __HMS_SUPER(__f,__l) { }
  115.   hash_multiset(const_iterator __f, const_iterator __l, size_type __n) : __HMS_SUPER(__f,__l,__n) { }
  116.   hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
  117.            const hasher& __hf) : __HMS_SUPER(__f, __l, __n, __hf) { }
  118.   hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
  119.            const hasher& __hf, const key_equal& __eql) : __HMS_SUPER(__f, __l, __n, __hf, __eql) { }
  120. # if defined (_STLP_BASE_MATCH_BUG)
  121.   friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& __hs1, const _Self& __hs2);
  122. # endif
  123. };
  124.  
  125. # if defined (_STLP_BASE_MATCH_BUG)
  126. __HS_TEMPLATE_HEADER
  127. inline bool operator==(const hash_multiset< __HS_ARGUMENTS >& __hs1, 
  128.                        const hash_multiset< __HS_ARGUMENTS >& __hs2)
  129. {
  130.     typedef __HMS_SUPER  __s;
  131.     return _STLP_STD::operator==((const __s&)__hs1,(const __s&)__hs2);
  132. }
  133. # endif
  134.  
  135.  
  136. # undef __HS_SUPER
  137. # undef __HMS_SUPER
  138. # undef __HS_ARGUMENTS
  139. # undef __HS_BASE_ARGUMENTS
  140. # undef __HS_TEMPLATE_HEADER
  141.  
  142. # ifdef _STLP_USE_NAMESPACES
  143. } /* namespace STLPORT */
  144. # endif
  145.  
  146. #endif /* _STLP_INTERNAL_HASH_SET_H */
  147.  
  148. // Local Variables:
  149. // mode:C++
  150. // End:
  151.