00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 #ifndef STLSOFT_INCL_H_STLSOFT
00070 # include "stlsoft.h"
00071 #endif
00072
00073 #if defined(__STLSOFT_COMPILER_IS_BORLAND)
00074 # error stlsoft_associative_container_veneer.h is incompatible with the Borland C/C++ compiler
00075 #endif
00076
00077 #ifndef STLSOFT_INCL_H_STLSOFT_FUNCTIONALS
00078 # include "stlsoft_functionals.h"
00079 #endif
00080
00081
00082
00083
00084
00085 #ifndef _STLSOFT_NO_NAMESPACE
00086 namespace stlsoft
00087 {
00088 #endif
00089
00090
00091
00092
00093
00099 template< ss_typename_param_k T
00100 , ss_typename_param_k FV
00101 #ifdef __STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
00102 , ss_typename_param_k FK = noop_function<ss_typename_type_def_k T::key_type>
00103 #else
00104 , ss_typename_param_k FK
00105 #endif
00106 >
00107 class associative_container_veneer
00108 : public T
00109 {
00110 public:
00112 typedef T container_type;
00114 typedef FV value_destruction_function_type;
00116 typedef FK key_destruction_function_type;
00118 typedef associative_container_veneer<T, FV, FK> class_type;
00120 private:
00121 typedef T parent_class_type;
00122 public:
00124 typedef ss_typename_type_k parent_class_type::key_compare key_compare;
00126 typedef ss_typename_type_k parent_class_type::allocator_type allocator_type;
00128 typedef ss_typename_type_k parent_class_type::size_type size_type;
00129
00130
00131 public:
00132 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00133
00134 associative_container_veneer()
00135 {}
00136
00138 associative_container_veneer(class_type const &rhs)
00139 : parent_class_type(rhs)
00140 {}
00141
00142 #if !defined(__STLSOFT_COMPILER_IS_DMC)
00143
00144 ss_explicit_k associative_container_veneer(const key_compare& comp)
00145 : parent_class_type(comp)
00146 {}
00148 associative_container_veneer(const key_compare& comp, allocator_type const &a)
00149 : parent_class_type(comp, a)
00150 {}
00152 template <ss_typename_param_k I>
00153 associative_container_veneer(I i1, I i2)
00154 : parent_class_type(i1, i2)
00155 {}
00157 template <ss_typename_param_k I>
00158 associative_container_veneer(I i1, I i2, key_compare const &comp)
00159 : parent_class_type(i1, i2, comp)
00160 {}
00162 template <ss_typename_param_k I>
00163 associative_container_veneer(I i1, I i2, key_compare const &comp, allocator_type const &a)
00164 : parent_class_type(i1, i2, comp, a)
00165 {}
00166 #else
00167 template <ss_typename_param_k N1>
00168 ss_explicit_k associative_container_veneer(N1 n1)
00169 : parent_class_type(n1)
00170 {}
00171 template< ss_typename_param_k N1
00172 , ss_typename_param_k N2
00173 >
00174 associative_container_veneer(N1 n1, N2 n2)
00175 : parent_class_type(n1, n2)
00176 {}
00177 template< ss_typename_param_k N1
00178 , ss_typename_param_k N2
00179 , ss_typename_param_k N3
00180 >
00181 associative_container_veneer(N1 n1, N2 n2, N3 n3)
00182 : parent_class_type(n1, n2, n3)
00183 {}
00184 template< ss_typename_param_k N1
00185 , ss_typename_param_k N2
00186 , ss_typename_param_k N3
00187 , ss_typename_param_k N4
00188 >
00189 associative_container_veneer(N1 n1, N2 n2, N3 n3, N4 n4)
00190 : parent_class_type(n1, n2, n3, n4)
00191 {}
00192 template< ss_typename_param_k N1
00193 , ss_typename_param_k N2
00194 , ss_typename_param_k N3
00195 , ss_typename_param_k N4
00196 , ss_typename_param_k N5
00197 >
00198 associative_container_veneer(N1 n1, N2 n2, N3 n3, N4 n4, N5 n5)
00199 : parent_class_type(n1, n2, n3, n4, n5)
00200 {}
00201 #endif
00202 #endif
00203
00206 ~associative_container_veneer() stlsoft_throw_0()
00207 {
00208
00209
00210 typedef select_both < key_destruction_function_type
00211 , value_destruction_function_type
00212 #ifndef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00213 , ss_typename_type_k container_type::iterator::value_type
00214 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00215 > destruction_function_t;
00216
00217
00218
00219
00220 ss_typename_type_k container_type::iterator b = container_type::begin();
00221 ss_typename_type_k container_type::iterator e = container_type::end();
00222
00223 for(destruction_function_t fn; b != e; ++b)
00224 {
00225 fn(*b);
00226 }
00227 }
00228
00235 class_type &operator =(class_type const &rhs)
00236 {
00237 parent_class_type::operator =(rhs);
00238
00239 return *this;
00240 }
00241
00242 protected:
00245 void *operator new(size_t )
00246 {
00247 return 0;
00248 }
00251 void operator delete(void *)
00252 {}
00253 };
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265