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 
00048 #ifndef STLSOFT_INCL_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_CONTAINER_VENEER
00049 #define STLSOFT_INCL_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_CONTAINER_VENEER
00050 
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define STLSOFT_VER_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_CONTAINER_VENEER_MAJOR     4
00053 # define STLSOFT_VER_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_CONTAINER_VENEER_MINOR     0
00054 # define STLSOFT_VER_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_CONTAINER_VENEER_REVISION  4
00055 # define STLSOFT_VER_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_CONTAINER_VENEER_EDIT      47
00056 #endif 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00074 # include <stlsoft/stlsoft.h>
00075 #endif 
00076 
00077 #if defined(STLSOFT_COMPILER_IS_BORLAND)
00078 # error stlsoft/collections/associative_container_veneer.hpp is incompatible with the Borland C/C++ compiler
00079 #endif 
00080 
00081 #ifndef STLSOFT_INCL_STLSOFT_FUNCTIONAL_HPP_NOOP
00082 # include <stlsoft/functional/noop.hpp>
00083 #endif 
00084 #ifndef STLSOFT_INCL_STLSOFT_COLLECTIONS_UTIL_HPP_COLLECTIONS
00085 # include <stlsoft/collections/util/collections.hpp>
00086 #endif 
00087 #ifndef STLSOFT_INCL_STLSOFT_OBSOLETE_HPP_FUNCTIONALS
00088 # include <stlsoft/obsolete/functionals.hpp>
00089 #endif 
00090 
00091 
00092 
00093 
00094 
00095 #ifndef _STLSOFT_NO_NAMESPACE
00096 namespace stlsoft
00097 {
00098 #endif 
00099 
00100 
00101 
00102 
00103 
00114 template<   ss_typename_param_k T
00115         ,   ss_typename_param_k FV
00116 #ifdef STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
00117         ,   ss_typename_param_k FK = noop_function<ss_typename_type_def_k T::key_type>
00118 #else 
00119         ,   ss_typename_param_k FK 
00120 #endif 
00121         >
00122 class associative_container_veneer
00123     : public T
00124     , public stl_collection_tag
00125 {
00126 public:
00128     typedef T                                                       container_type;
00130     typedef FV                                                      value_destruction_function_type;
00132     typedef FK                                                      key_destruction_function_type;
00134     typedef associative_container_veneer<T, FV, FK>                 class_type;
00136 private:
00137     typedef T                                                       parent_class_type;
00138 public:
00140     typedef ss_typename_type_k parent_class_type::key_compare       key_compare;
00142     typedef ss_typename_type_k parent_class_type::allocator_type    allocator_type;
00144     typedef ss_typename_type_k parent_class_type::size_type         size_type;
00145 
00146 
00147 public:
00148 #ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00150     associative_container_veneer()
00151     {}
00152 
00154     associative_container_veneer(class_type const& rhs)
00155         : parent_class_type(rhs)
00156     {}
00157 
00158 # if !defined(STLSOFT_COMPILER_IS_DMC)
00160     ss_explicit_k associative_container_veneer(key_compare const& comp)
00161         : parent_class_type(comp)
00162     {}
00164     associative_container_veneer(key_compare const& comp, allocator_type const& a)
00165         : parent_class_type(comp, a)
00166     {}
00168     template <ss_typename_param_k I>
00169     associative_container_veneer(I i1, I i2)
00170         : parent_class_type(i1, i2)
00171     {}
00173     template <ss_typename_param_k I>
00174     associative_container_veneer(I i1, I i2, key_compare const& comp)
00175         : parent_class_type(i1, i2, comp)
00176     {}
00178     template <ss_typename_param_k I>
00179     associative_container_veneer(I i1, I i2, key_compare const& comp, allocator_type const& a)
00180         : parent_class_type(i1, i2, comp, a)
00181     {}
00182 # else 
00183     template <ss_typename_param_k N1>
00184     ss_explicit_k associative_container_veneer(N1 n1)
00185         : parent_class_type(n1)
00186     {}
00187     template<   ss_typename_param_k N1
00188             ,   ss_typename_param_k N2
00189             >
00190     associative_container_veneer(N1 n1, N2 n2)
00191         : parent_class_type(n1, n2)
00192     {}
00193     template<   ss_typename_param_k N1
00194             ,   ss_typename_param_k N2
00195             ,   ss_typename_param_k N3
00196             >
00197     associative_container_veneer(N1 n1, N2 n2, N3 n3)
00198         : parent_class_type(n1, n2, n3)
00199     {}
00200     template<   ss_typename_param_k N1
00201             ,   ss_typename_param_k N2
00202             ,   ss_typename_param_k N3
00203             ,   ss_typename_param_k N4
00204             >
00205     associative_container_veneer(N1 n1, N2 n2, N3 n3, N4 n4)
00206         : parent_class_type(n1, n2, n3, n4)
00207     {}
00208     template<   ss_typename_param_k N1
00209             ,   ss_typename_param_k N2
00210             ,   ss_typename_param_k N3
00211             ,   ss_typename_param_k N4
00212             ,   ss_typename_param_k N5
00213             >
00214     associative_container_veneer(N1 n1, N2 n2, N3 n3, N4 n4, N5 n5)
00215         : parent_class_type(n1, n2, n3, n4, n5)
00216     {}
00217 # endif 
00218 #endif 
00219 
00222     ~associative_container_veneer() stlsoft_throw_0()
00223     {
00224         
00225         
00226         typedef select_both <   key_destruction_function_type
00227                             ,   value_destruction_function_type
00228 #ifndef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00229                             ,   ss_typename_type_k container_type::iterator::value_type
00230 #endif // STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00231                             >   destruction_function_t;
00232 
00233         
00234         
00235 
00236         ss_typename_type_k container_type::iterator b   =   container_type::begin();
00237         ss_typename_type_k container_type::iterator e   =   container_type::end();
00238 
00239         for(destruction_function_t fn; b != e; ++b)
00240         {
00241             fn(*b);
00242         }
00243     }
00244 
00251     class_type& operator =(class_type const& rhs)
00252     {
00253         parent_class_type::operator =(rhs);
00254 
00255         return *this;
00256     }
00257 
00258 protected:
00261     void *operator new(ss_size_t )
00262     {
00263         return 0;
00264     }
00267     void operator delete(void*)
00268     {}
00269 };
00270 
00271 
00272 
00273 #ifndef _STLSOFT_NO_NAMESPACE
00274 } 
00275 #endif 
00276 
00277 
00278 
00279 #endif 
00280 
00281