00001 /**** 00002 ***** Copyright 2010 Intel Corporation All Rights Reserved. 00003 ***** 00004 ***** The source code, information and material contained herein are owned by Intel Corporation or its suppliers ***** 00005 ***** or licensors, and title to such Material remains with Intel Corporation or its suppliers or licensors. ***** 00006 ***** The Material contains proprietary information of Intel or its suppliers and licensors. The Material is ***** 00007 ***** protected by worldwide copyright laws and treaty provisions. No part of the Material may be used, copied, ***** 00008 ***** reproduced, modified, published, uploaded, posted, transmitted, distributed or disclosed in any way without ***** 00009 ***** Intel's prior express written permission. 00010 ***** 00011 ***** No license under any patent, copyright or other intellectual property rights in the material is granted to ***** 00012 ***** or conferred upon you, either expressly, by implication, inducement, estoppel or otherwise. Any license ***** 00013 ***** under such intellectual property rights must be express and approved by Intel in writing. 00014 ****/ 00015 00016 /**** Copyright Ends ****/ 00017 00018 #ifndef ARBB_CPP_RANGE_ITERATOR_FUNCS_HPP 00019 #define ARBB_CPP_RANGE_ITERATOR_FUNCS_HPP 00020 00021 #include "type_traits.hpp" 00022 #include "config.hpp" 00023 #include "range.hpp" 00024 00025 namespace ARBB_CPP_NS { 00026 00029 00033 template <typename T> 00034 bool operator==(const range_iterator<T>& a, const range_iterator<T>& b) 00035 { 00036 return 0 == a.difference(b); 00037 } 00038 00042 template <typename T> 00043 bool operator==(const const_range_iterator<T>& a, const const_range_iterator<T>& b) 00044 { 00045 return 0 == a.difference(b); 00046 } 00047 00051 template <typename T> 00052 bool operator!=(const range_iterator<T>& a, const range_iterator<T>& b) 00053 { 00054 return !(a == b); 00055 } 00056 00060 template <typename T> 00061 bool operator!=(const const_range_iterator<T>& a, const const_range_iterator<T>& b) 00062 { 00063 return !(a == b); 00064 } 00065 00070 template <typename T> 00071 bool operator<(const range_iterator<T>& a, const range_iterator<T>& b) 00072 { 00073 return 0 > a.difference(b); 00074 } 00075 00080 template <typename T> 00081 bool operator<(const const_range_iterator<T>& a, const const_range_iterator<T>& b) 00082 { 00083 return 0 > a.difference(b); 00084 } 00085 00090 template <typename T> 00091 bool operator<=(const range_iterator<T>& a, const range_iterator<T>& b) 00092 { 00093 return !(b < a); 00094 } 00095 00100 template <typename T> 00101 bool operator<=(const const_range_iterator<T>& a, const const_range_iterator<T>& b) 00102 { 00103 return !(b < a); 00104 } 00105 00110 template <typename T> 00111 bool operator>(const range_iterator<T>& a, const range_iterator<T>& b) 00112 { 00113 return b < a; 00114 } 00115 00120 template <typename T> 00121 bool operator>(const const_range_iterator<T>& a, const const_range_iterator<T>& b) 00122 { 00123 return b < a; 00124 } 00125 00130 template <typename T> 00131 bool operator>=(const range_iterator<T>& a, const range_iterator<T>& b) 00132 { 00133 return !(a < b); 00134 } 00135 00140 template <typename T> 00141 bool operator>=(const const_range_iterator<T>& a, const const_range_iterator<T>& b) 00142 { 00143 return !(a < b); 00144 } 00145 00147 template <typename T> 00148 range_iterator<T> operator+(range_iterator<T> a, typename range_iterator<T>::difference_type b) 00149 { 00150 return range_iterator<T>(a) += b; 00151 } 00152 00154 template <typename T> 00155 const_range_iterator<T> operator+(const_range_iterator<T> a, typename const_range_iterator<T>::difference_type b) 00156 { 00157 return const_range_iterator<T>(a) += b; 00158 } 00159 00161 template <typename T> 00162 range_iterator<T> operator+(typename range_iterator<T>::difference_type a, range_iterator<T> b) 00163 { 00164 return range_iterator<T>(b) += a; 00165 } 00166 00168 template <typename T> 00169 const_range_iterator<T> operator+(typename const_range_iterator<T>::difference_type a, const_range_iterator<T> b) 00170 { 00171 return const_range_iterator<T>(b) += a; 00172 } 00173 00178 template <typename T> 00179 typename range_iterator<T>::difference_type operator-(range_iterator<T> a, range_iterator<T> b) 00180 { 00181 return a.difference(b); 00182 } 00183 00188 template <typename T> 00189 typename const_range_iterator<T>::difference_type operator-(const_range_iterator<T> a, const_range_iterator<T> b) 00190 { 00191 return a.difference(b); 00192 } 00193 00195 template <typename T> 00196 range_iterator<T> operator-(range_iterator<T> a, typename range_iterator<T>::difference_type b) 00197 { 00198 return range_iterator<T>(a) -= b; 00199 } 00200 00202 template <typename T> 00203 const_range_iterator<T> operator-(const_range_iterator<T> a, typename const_range_iterator<T>::difference_type b) 00204 { 00205 return const_range_iterator<T>(a) -= b; 00206 } 00207 00209 00210 } // namespace ARBB_CPP_NS 00211 00212 #endif // ARBB_CPP_RANGE_ITERATOR_FUNCS_HPP
Copyright © 2010, Intel Corporation. All rights reserved.