Wiselib
|
00001 /*************************************************************************** 00002 ** This file is part of the generic algorithm library Wiselib. ** 00003 ** Copyright (C) 2008,2009 by the Wisebed (www.wisebed.eu) project. ** 00004 ** ** 00005 ** The Wiselib is free software: you can redistribute it and/or modify ** 00006 ** it under the terms of the GNU Lesser General Public License as ** 00007 ** published by the Free Software Foundation, either version 3 of the ** 00008 ** License, or (at your option) any later version. ** 00009 ** ** 00010 ** The Wiselib is distributed in the hope that it will be useful, ** 00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** 00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** 00013 ** GNU Lesser General Public License for more details. ** 00014 ** ** 00015 ** You should have received a copy of the GNU Lesser General Public ** 00016 ** License along with the Wiselib. ** 00017 ** If not, see <http://www.gnu.org/licenses/>. ** 00018 ***************************************************************************/ 00019 #ifndef __WISELIB_INTERNAL_INTERFACE_STL_ITERATOR_BASE_TYPES_H 00020 #define __WISELIB_INTERNAL_INTERFACE_STL_ITERATOR_BASE_TYPES_H 00021 00022 #include <stdint.h> 00023 00024 namespace wiselib 00025 { 00026 00027 struct input_iterator_tag {}; 00028 struct output_iterator_tag {}; 00029 struct forward_iterator_tag : public input_iterator_tag {}; 00030 struct bidirectional_iterator_tag : public forward_iterator_tag {}; 00031 struct random_access_iterator_tag : public bidirectional_iterator_tag {}; 00032 // ----------------------------------------------------------------------- 00033 // ----------------------------------------------------------------------- 00034 // ----------------------------------------------------------------------- 00035 template<typename Category_P, 00036 typename Iterator_P, 00037 typename Distance_P = uint16_t, 00038 typename Pointer_P = Iterator_P*, 00039 typename Reference_P = Iterator_P&> 00040 struct iterator 00041 { 00042 typedef Category_P iterator_category; 00043 typedef Iterator_P value_type; 00044 typedef Distance_P difference_type; 00045 typedef Pointer_P pointer; 00046 typedef Reference_P reference; 00047 }; 00048 // ----------------------------------------------------------------------- 00049 // ----------------------------------------------------------------------- 00050 // ----------------------------------------------------------------------- 00051 template<typename Iterator_P> 00052 struct iterator_traits 00053 { 00054 typedef typename Iterator_P::iterator_category iterator_category; 00055 typedef typename Iterator_P::value_type value_type; 00056 typedef typename Iterator_P::difference_type difference_type; 00057 typedef typename Iterator_P::pointer pointer; 00058 typedef typename Iterator_P::reference reference; 00059 }; 00060 // ----------------------------------------------------------------------- 00061 // ----------------------------------------------------------------------- 00062 // ----------------------------------------------------------------------- 00063 template<typename Iterator_P> 00064 struct iterator_traits<Iterator_P*> 00065 { 00066 typedef random_access_iterator_tag iterator_category; 00067 typedef Iterator_P value_type; 00068 typedef uint16_t difference_type; 00069 typedef Iterator_P* pointer; 00070 typedef Iterator_P& reference; 00071 }; 00072 00073 } 00074 00075 #endif