_hash_set.h

00001 /*
00002  * Copyright (c) 1999, 2000
00003  * Boris Fomitchev
00004  *
00005  * This material is provided "as is", with absolutely no warranty expressed
00006  * or implied. Any use is at your own risk.
00007  *
00008  * Permission to use or copy this software for any purpose is hereby granted 
00009  * without fee, provided the above notices are retained on all copies.
00010  * Permission to modify the code and to distribute modified code is granted,
00011  * provided the above notices are retained, and a notice that the code was
00012  * modified is included with the above copyright notice.
00013  *
00014  */
00015 
00016 /* NOTE: This is an internal header file, included by other STL headers.
00017  *   You should not attempt to use it directly.
00018  */
00019 
00020 #ifndef _STLP_INTERNAL_WRAP_HASH_SET_H
00021 #define _STLP_INTERNAL_WRAP_HASH_SET_H
00022 
00023 #ifndef _STLP_INTERNAL_HASH_SET_H
00024 # include <stl/_hash_set.h>
00025 #endif
00026 
00027 # ifdef _STLP_USE_NAMESPACES
00028 namespace STLPORT { 
00029 # endif
00030 
00031 #  if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
00032 #   define __HS_TEMPLATE_HEADER  template <class _Value>
00033 #   define __HS_ARGUMENTS        _Value
00034 #   define __HS_BASE_ARGUMENTS   _Value, hash<_Value>, equal_to<_Value>, _STLP_DEFAULT_ALLOCATOR(_Value)
00035 #  else
00036 #   define __HS_TEMPLATE_HEADER  template <class _Value, class _HashFcn, class _EqualKey >
00037 #   define __HS_ARGUMENTS        _Value, _HashFcn, _EqualKey
00038 #   define __HS_BASE_ARGUMENTS   _Value, _HashFcn, _EqualKey, _STLP_DEFAULT_ALLOCATOR(_Value)
00039 #  endif
00040 
00041 
00042 #  define __HS_SUPER  __hash_set< __HS_BASE_ARGUMENTS >
00043 #  define __HMS_SUPER __hash_multiset< __HS_BASE_ARGUMENTS >
00044 
00045 
00046 // provide a "default" hash_set adaptor
00047 __HS_TEMPLATE_HEADER
00048 class hash_set : public __HS_SUPER 
00049 {
00050   typedef hash_set< __HS_ARGUMENTS > _Self;
00051 public:
00052   typedef  __HS_SUPER _Super;
00053   __IMPORT_WITH_ITERATORS(_Super)
00054   typedef typename _Super::key_type key_type;
00055   typedef typename _Super::hasher hasher;
00056   typedef typename _Super::key_equal key_equal;
00057   hash_set() {}
00058   hash_set(size_type n) : __HS_SUPER(n) {}
00059   hash_set(size_type n, const hasher& hf) : __HS_SUPER(n, hf) {}
00060   hash_set(size_type n, const hasher& hf, const key_equal& eql): __HS_SUPER(n, hf, eql) {}
00061 
00062   hash_set(const value_type* f, const value_type* l) : __HS_SUPER(f,l) {}
00063   hash_set(const value_type* f, const value_type* l, size_type n): __HS_SUPER(f,l,n) {}
00064   hash_set(const value_type* f, const value_type* l, size_type n,
00065            const hasher& hf) : __HS_SUPER(f,l,n,hf) {}
00066   hash_set(const value_type* f, const value_type* l, size_type n,
00067            const hasher& hf, const key_equal& eql) : __HS_SUPER(f,l,n,hf, eql) {}
00068 
00069   hash_set(const_iterator f, const_iterator l) : __HS_SUPER(f,l) { }
00070   hash_set(const_iterator f, const_iterator l, size_type n) : __HS_SUPER(f,l,n) { }
00071   hash_set(const_iterator f, const_iterator l, size_type n,
00072            const hasher& hf) : __HS_SUPER(f, l, n, hf) { }
00073   hash_set(const_iterator f, const_iterator l, size_type n,
00074            const hasher& hf, const key_equal& eql) : __HS_SUPER(f, l, n, hf, eql) { }
00075 # if defined (_STLP_BASE_MATCH_BUG)
00076     friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& hs1, const _Self& hs2);
00077 # endif
00078 };
00079 
00080 # if defined (_STLP_BASE_MATCH_BUG)
00081 __HS_TEMPLATE_HEADER
00082 inline bool operator==(const hash_set< __HS_ARGUMENTS >& hs1, 
00083                        const hash_set< __HS_ARGUMENTS >& hs2)
00084 {
00085     typedef __HS_SUPER _Super;
00086     return (const _Super&)hs1 == (const _Super&)hs2; 
00087 }
00088 # endif
00089 
00090 // provide a "default" hash_multiset adaptor
00091 __HS_TEMPLATE_HEADER
00092 class hash_multiset : public __HMS_SUPER
00093 {
00094   typedef hash_multiset< __HS_ARGUMENTS > _Self;
00095 public:
00096   typedef __HMS_SUPER _Super;
00097   __IMPORT_WITH_ITERATORS(_Super)
00098   typedef typename _Super::key_type key_type;
00099   typedef typename _Super::hasher hasher;
00100   typedef typename _Super::key_equal key_equal;
00101 
00102   hash_multiset() {}
00103   hash_multiset(size_type __n) : __HMS_SUPER(__n) {}
00104   hash_multiset(size_type __n, const hasher& __hf) : __HMS_SUPER(__n, __hf) {}
00105   hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql): __HMS_SUPER(__n, __hf, __eql) {}
00106 
00107   hash_multiset(const value_type* __f, const value_type* __l) : __HMS_SUPER(__f,__l) {}
00108   hash_multiset(const value_type* __f, const value_type* __l, size_type __n): __HMS_SUPER(__f,__l,__n) {}
00109   hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
00110            const hasher& __hf) : __HMS_SUPER(__f,__l,__n,__hf) {}
00111   hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
00112            const hasher& __hf, const key_equal& __eql) : __HMS_SUPER(__f,__l,__n,__hf, __eql) {}
00113 
00114   hash_multiset(const_iterator __f, const_iterator __l) : __HMS_SUPER(__f,__l) { }
00115   hash_multiset(const_iterator __f, const_iterator __l, size_type __n) : __HMS_SUPER(__f,__l,__n) { }
00116   hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
00117            const hasher& __hf) : __HMS_SUPER(__f, __l, __n, __hf) { }
00118   hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
00119            const hasher& __hf, const key_equal& __eql) : __HMS_SUPER(__f, __l, __n, __hf, __eql) { }
00120 # if defined (_STLP_BASE_MATCH_BUG)
00121   friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& __hs1, const _Self& __hs2);
00122 # endif
00123 };
00124 
00125 # if defined (_STLP_BASE_MATCH_BUG)
00126 __HS_TEMPLATE_HEADER
00127 inline bool operator==(const hash_multiset< __HS_ARGUMENTS >& __hs1, 
00128                        const hash_multiset< __HS_ARGUMENTS >& __hs2)
00129 {
00130     typedef __HMS_SUPER  __s;
00131     return _STLP_STD::operator==((const __s&)__hs1,(const __s&)__hs2);
00132 }
00133 # endif
00134 
00135 
00136 # undef __HS_SUPER
00137 # undef __HMS_SUPER
00138 # undef __HS_ARGUMENTS
00139 # undef __HS_BASE_ARGUMENTS
00140 # undef __HS_TEMPLATE_HEADER
00141 
00142 # ifdef _STLP_USE_NAMESPACES
00143 } /* namespace STLPORT */
00144 # endif
00145 
00146 #endif /* _STLP_INTERNAL_HASH_SET_H */
00147 
00148 // Local Variables:
00149 // mode:C++
00150 // End:

Generated on Mon Jun 5 10:20:46 2006 for Intelligence.kdevelop by  doxygen 1.4.6