File indexing completed on 2024-11-15 09:18:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_MULTI_ARRAY_CONCEPT_CHECKS_HPP
0014 #define BOOST_MULTI_ARRAY_CONCEPT_CHECKS_HPP
0015
0016
0017
0018
0019
0020
0021 #include "boost/concept_check.hpp"
0022 #include "boost/iterator/iterator_concepts.hpp"
0023
0024 namespace boost {
0025 namespace multi_array_concepts {
0026
0027 namespace detail {
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 template <std::size_t N>
0038 struct idgen_helper {
0039
0040 template <typename Array, typename IdxGen, typename Call_Type>
0041 static void call(Array& a, const IdxGen& idgen, Call_Type c) {
0042 idgen_helper<N-1>::call(a,idgen[c],c);
0043 }
0044 };
0045
0046 template <>
0047 struct idgen_helper<0> {
0048
0049 template <typename Array, typename IdxGen, typename Call_Type>
0050 static void call(Array& a, const IdxGen& idgen, Call_Type) {
0051 a[ idgen ];
0052 }
0053 };
0054
0055 }
0056
0057
0058 template <typename Array, std::size_t NumDims >
0059 struct ConstMultiArrayConcept
0060 {
0061 void constraints() {
0062
0063 function_requires< boost_concepts::ForwardTraversalConcept<iterator> >();
0064 function_requires< boost_concepts::ReadableIteratorConcept<iterator> >();
0065 function_requires< boost_concepts::ForwardTraversalConcept<const_iterator> >();
0066 function_requires< boost_concepts::ReadableIteratorConcept<const_iterator> >();
0067
0068
0069 a[ id ];
0070
0071 detail::idgen_helper<NumDims-1>::call(a,idgen[range],id);
0072
0073
0074 detail::idgen_helper<NumDims-1>::call(a,idgen[range],range);
0075
0076 st = a.size();
0077 st = a.num_dimensions();
0078 st = Array::dimensionality;
0079 st = a.num_elements();
0080 stp = a.shape();
0081 idp = a.strides();
0082 idp = a.index_bases();
0083 cit = a.begin();
0084 cit = a.end();
0085 crit = a.rbegin();
0086 crit = a.rend();
0087 eltp = a.origin();
0088 }
0089
0090 typedef typename Array::value_type value_type;
0091 typedef typename Array::reference reference;
0092 typedef typename Array::const_reference const_reference;
0093 typedef typename Array::size_type size_type;
0094 typedef typename Array::difference_type difference_type;
0095 typedef typename Array::iterator iterator;
0096 typedef typename Array::const_iterator const_iterator;
0097 typedef typename Array::reverse_iterator reverse_iterator;
0098 typedef typename Array::const_reverse_iterator const_reverse_iterator;
0099 typedef typename Array::element element;
0100 typedef typename Array::index index;
0101 typedef typename Array::index_gen index_gen;
0102 typedef typename Array::index_range index_range;
0103 typedef typename Array::extent_gen extent_gen;
0104 typedef typename Array::extent_range extent_range;
0105
0106 Array a;
0107 size_type st;
0108 const size_type* stp;
0109 index id;
0110 const index* idp;
0111 const_iterator cit;
0112 const_reverse_iterator crit;
0113 const element* eltp;
0114 index_gen idgen;
0115 index_range range;
0116 };
0117
0118
0119 template <typename Array, std::size_t NumDims >
0120 struct MutableMultiArrayConcept
0121 {
0122 void constraints() {
0123
0124
0125 function_requires< boost_concepts::ForwardTraversalConcept<iterator> >();
0126 function_requires< boost_concepts::ReadableIteratorConcept<iterator> >();
0127 function_requires< boost_concepts::WritableIteratorConcept<iterator> >();
0128 function_requires< boost_concepts::ForwardTraversalConcept<const_iterator> >();
0129 function_requires< boost_concepts::ReadableIteratorConcept<const_iterator> >();
0130 function_requires< boost::OutputIterator<iterator,value_type> >();
0131
0132
0133 value_type vt = a[ id ];
0134
0135
0136 detail::idgen_helper<NumDims-1>::call(a,idgen[range],id);
0137
0138
0139 detail::idgen_helper<NumDims-1>::call(a,idgen[range],range);
0140
0141 st = a.size();
0142 st = a.num_dimensions();
0143 st = a.num_elements();
0144 stp = a.shape();
0145 idp = a.strides();
0146 idp = a.index_bases();
0147 it = a.begin();
0148 it = a.end();
0149 rit = a.rbegin();
0150 rit = a.rend();
0151 eltp = a.origin();
0152 const_constraints(a);
0153 }
0154
0155 void const_constraints(const Array& a) {
0156
0157
0158
0159
0160 detail::idgen_helper<NumDims-1>::call(a,idgen[range],id);
0161
0162
0163 detail::idgen_helper<NumDims-1>::call(a,idgen[range],range);
0164
0165 st = a.size();
0166 st = a.num_dimensions();
0167 st = a.num_elements();
0168 stp = a.shape();
0169 idp = a.strides();
0170 idp = a.index_bases();
0171 cit = a.begin();
0172 cit = a.end();
0173 crit = a.rbegin();
0174 crit = a.rend();
0175 eltp = a.origin();
0176 }
0177
0178 typedef typename Array::value_type value_type;
0179 typedef typename Array::reference reference;
0180 typedef typename Array::const_reference const_reference;
0181 typedef typename Array::size_type size_type;
0182 typedef typename Array::difference_type difference_type;
0183 typedef typename Array::iterator iterator;
0184 typedef typename Array::const_iterator const_iterator;
0185 typedef typename Array::reverse_iterator reverse_iterator;
0186 typedef typename Array::const_reverse_iterator const_reverse_iterator;
0187 typedef typename Array::element element;
0188 typedef typename Array::index index;
0189 typedef typename Array::index_gen index_gen;
0190 typedef typename Array::index_range index_range;
0191 typedef typename Array::extent_gen extent_gen;
0192 typedef typename Array::extent_range extent_range;
0193
0194 Array a;
0195 size_type st;
0196 const size_type* stp;
0197 index id;
0198 const index* idp;
0199 iterator it;
0200 const_iterator cit;
0201 reverse_iterator rit;
0202 const_reverse_iterator crit;
0203 const element* eltp;
0204 index_gen idgen;
0205 index_range range;
0206 };
0207
0208
0209 }
0210
0211 namespace detail {
0212 namespace multi_array {
0213 using boost::multi_array_concepts::ConstMultiArrayConcept;
0214 using boost::multi_array_concepts::MutableMultiArrayConcept;
0215 }
0216 }
0217
0218 }
0219
0220
0221 #endif