00001 00002 #ifndef INSTIGATE_STL_DESTRUCTIBLE_ITERATOR_HPP 00003 #define INSTIGATE_STL_DESTRUCTIBLE_ITERATOR_HPP 00004 00054 // headers from this project 00055 00056 // headers from other projects 00057 00058 // headers from standard libraries 00059 #include <iostream> 00060 #include <cassert> 00061 00062 // Forward declaration 00063 namespace instigate { 00064 namespace stl { 00074 namespace destructible_iterator { 00075 template <typename T> struct interface; 00076 template <> struct interface<char*>; 00077 template <> struct interface<int*>; 00078 template <> struct interface<long*>; 00079 template <> struct interface<float*>; 00080 template <> struct interface<double*>; 00081 template <> struct interface<wchar_t*>; 00082 template <typename T> struct requirements; 00083 } 00084 } 00085 } 00086 00092 template<typename T> 00093 struct instigate::stl::destructible_iterator::interface 00094 { 00100 template <typename Tp> 00101 static inline void destroy(Tp* pointer) 00102 { 00103 assert(0 != pointer); 00104 pointer->~Tp(); 00105 } 00106 00107 }; 00108 00113 template<> 00114 struct instigate::stl::destructible_iterator::interface<char*> 00115 { 00117 static inline void destroy(char*, char*) 00118 { 00119 } 00120 }; 00121 00126 template<> 00127 struct instigate::stl::destructible_iterator::interface<int*> 00128 { 00130 static inline void destroy(int*, int*) 00131 { 00132 } 00133 }; 00134 00139 template<> 00140 struct instigate::stl::destructible_iterator::interface<long*> 00141 { 00143 static inline void destroy(long*, long*) 00144 { 00145 } 00146 }; 00147 00152 template<> 00153 struct instigate::stl::destructible_iterator::interface<float*> 00154 { 00156 static inline void destroy(float*, float*) 00157 { 00158 } 00159 }; 00160 00165 template<> 00166 struct instigate::stl::destructible_iterator::interface<double*> 00167 { 00169 static inline void destroy(double*, double*) 00170 { 00171 } 00172 }; 00173 00178 template<> 00179 struct instigate::stl::destructible_iterator::interface<wchar_t*> 00180 { 00182 static inline void destroy(wchar_t*, wchar_t*) 00183 { 00184 } 00185 }; 00186 00192 template <typename T> 00193 struct instigate::stl::destructible_iterator::requirements 00194 { 00202 requirements() 00203 { 00204 } 00205 }; 00206 00207 // vim:et:tabstop=8:shiftwidth=8:cindent:fo=croq: 00208 00209 #endif // INSTIGATE_STL_DESTRUCTIBLE_ITERATOR_HPP