00001 00002 #ifndef _INSTIGATE_OPEN_SOURCE_INTERNAL_HEADER_IN_CONCEPT 00003 #error This is an internal header file used to implement Instigate STL.\ 00004 It should never be included directly by a program. 00005 #endif 00006 00007 #ifndef INSTIGATE_STL_CATEGORY_MAPPING_HPP 00008 #define INSTIGATE_STL_CATEGORY_MAPPING_HPP 00009 00058 // headers from this project 00059 #include "_incrementable_iterator.hpp" 00060 #include "_single_pass_iterator.hpp" 00061 #include "_forward_iterator.hpp" 00062 #include "_bidirectional_iterator.hpp" 00063 #include "_random_access_iterator.hpp" 00064 00065 // headers from other projects 00066 00067 // headers from standard library 00068 #include <iterator> 00069 00070 // forward declaration 00071 namespace instigate { 00072 namespace stl { 00073 template<typename I> 00074 struct category_mapping; 00075 00076 namespace implementation { 00077 template<typename I> 00078 struct category_mapping_aux; 00079 00080 template<> 00081 struct category_mapping_aux<std::input_iterator_tag>; 00082 00083 template<> 00084 struct category_mapping_aux<std::output_iterator_tag>; 00085 00086 template<> 00087 struct category_mapping_aux<std::forward_iterator_tag>; 00088 00089 template<> 00090 struct category_mapping_aux< 00091 std::bidirectional_iterator_tag>; 00092 00093 template<> 00094 struct category_mapping_aux< 00095 std::random_access_iterator_tag>; 00096 } 00097 } 00098 } 00099 00119 template <typename I> 00120 struct instigate::stl::category_mapping 00121 { 00123 typedef typename std::iterator_traits<I>::iterator_category 00124 sub_category; 00125 00127 typedef typename implementation::category_mapping_aux<sub_category>:: 00128 category category; 00129 }; 00130 00132 template<typename I> 00133 struct instigate::stl::implementation::category_mapping_aux 00134 { 00136 typedef I category; 00137 }; 00138 00143 template<> 00144 struct instigate::stl::implementation::category_mapping_aux< 00145 std::output_iterator_tag> 00146 { 00151 typedef stl::incrementable_iterator::tag category; 00152 }; 00153 00158 template<> 00159 struct instigate::stl::implementation::category_mapping_aux< 00160 std::input_iterator_tag> 00161 { 00166 typedef stl::single_pass_iterator::tag category; 00167 }; 00168 00173 template<> 00174 struct instigate::stl::implementation::category_mapping_aux< 00175 std::forward_iterator_tag> 00176 { 00181 typedef stl::forward_iterator::tag category; 00182 }; 00183 00188 template<> 00189 struct instigate::stl::implementation::category_mapping_aux< 00190 std::bidirectional_iterator_tag> 00191 { 00196 typedef stl::bidirectional_iterator::tag category; 00197 }; 00198 00203 template<> 00204 struct instigate::stl::implementation::category_mapping_aux< 00205 std::random_access_iterator_tag> 00206 { 00211 typedef stl::random_access_iterator::tag category; 00212 }; 00213 00214 // vim:et:tabstop=8:shiftwidth=8:cindent:fo=croq: 00215 00216 #endif