Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers iterator.h Source File

iterator.h

Go to the documentation of this file.
00001 ///\file
00002 
00003 /******************************************************************************
00004 The MIT License(MIT)
00005 
00006 Embedded Template Library.
00007 https://github.com/ETLCPP/etl
00008 http://www.etlcpp.com
00009 
00010 Copyright(c) 2017 jwellbelove
00011 
00012 Permission is hereby granted, free of charge, to any person obtaining a copy
00013 of this software and associated documentation files(the "Software"), to deal
00014 in the Software without restriction, including without limitation the rights
00015 to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
00016 copies of the Software, and to permit persons to whom the Software is
00017 furnished to do so, subject to the following conditions :
00018 
00019 The above copyright notice and this permission notice shall be included in all
00020 copies or substantial portions of the Software.
00021 
00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00023 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00024 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
00025 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00026 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00027 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00028 SOFTWARE.
00029 ******************************************************************************/
00030 
00031 #ifndef __ETL_ITERATOR__
00032 #define __ETL_ITERATOR__
00033 
00034 #include <iterator>
00035 
00036 #include "platform.h "
00037 #include "type_traits.h "
00038 
00039 ///\defgroup iterator iterator
00040 ///\ingroup utilities
00041 
00042 namespace etl
00043 {
00044   template <typename T>
00045   struct is_input_iterator
00046   {
00047     static const bool value = etl::is_same<typename std::iterator_traits<T>::iterator_category, std::input_iterator_tag>::value;
00048   };
00049 
00050   template <typename T>
00051   struct is_output_iterator
00052   {
00053     static const bool value = etl::is_same<typename std::iterator_traits<T>::iterator_category, std::output_iterator_tag>::value;
00054   };
00055 
00056   template <typename T>
00057   struct is_forward_iterator
00058   {
00059     static const bool value = etl::is_same<typename std::iterator_traits<T>::iterator_category, std::forward_iterator_tag>::value;
00060   };
00061 
00062   template <typename T>
00063   struct is_bidirectional_iterator
00064   {
00065     static const bool value = etl::is_same<typename std::iterator_traits<T>::iterator_category, std::bidirectional_iterator_tag>::value;
00066   };
00067 
00068   template <typename T>
00069   struct is_random_iterator
00070   {
00071     static const bool value = etl::is_same<typename std::iterator_traits<T>::iterator_category, std::random_access_iterator_tag>::value;
00072   };
00073 
00074   template <typename T>
00075   struct is_input_iterator_concept
00076   {
00077     static const bool value = etl::is_input_iterator<T>::value || 
00078                               etl::is_forward_iterator<T>::value ||
00079                               etl::is_bidirectional_iterator<T>::value ||
00080                               etl::is_random_iterator<T>::value;
00081   };
00082 
00083   template <typename T>
00084   struct is_output_iterator_concept
00085   {
00086     static const bool value = etl::is_output_iterator<T>::value ||
00087                               etl::is_forward_iterator<T>::value ||
00088                               etl::is_bidirectional_iterator<T>::value ||
00089                               etl::is_random_iterator<T>::value;
00090   };
00091 
00092   template <typename T>
00093   struct is_forward_iterator_concept
00094   {
00095     static const bool value = etl::is_forward_iterator<T>::value ||
00096                               etl::is_bidirectional_iterator<T>::value ||
00097                               etl::is_random_iterator<T>::value;
00098   };
00099 
00100   template <typename T>
00101   struct is_bidirectional_iterator_concept
00102   {
00103     static const bool value = etl::is_bidirectional_iterator<T>::value ||
00104                               etl::is_random_iterator<T>::value;
00105   };
00106 
00107   template <typename T>
00108   struct is_random_iterator_concept
00109   {
00110     static const bool value = etl::is_random_iterator<T>::value;
00111   };
00112 
00113 }
00114 
00115 #endif
00116 
00117