00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __STL_CONTAINER_CONCEPTS_H
00015 #define __STL_CONTAINER_CONCEPTS_H
00016
00017
00018 #include <concept_checks.h>
00019
00020 #ifdef __STL_USE_CONCEPT_CHECKS
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 struct _ERROR_IN_STL_CONTAINER {
00032
00033
00034
00035 template <class _Container>
00036 static void
00037 __begin_iterator_accessor_requirement_violation(_Container __c) {
00038 __c.begin();
00039 }
00040 template <class _Container>
00041 static void
00042 __const_begin_iterator_accessor_requirement_violation(const _Container& __c) {
00043 __c.begin();
00044 }
00045 template <class _Container>
00046 static void
00047 __end_iterator_accessor_requirement_violation(_Container __c) {
00048 __c.end();
00049 }
00050 template <class _Container>
00051 static void
00052 __const_end_iterator_accessor_requirement_violation(const _Container& __c) {
00053 __c.end();
00054 }
00055
00056 template <class _Container>
00057 static void
00058 __rbegin_iterator_accessor_requirement_violation(_Container __c) {
00059 __c.rbegin();
00060 }
00061 template <class _Container>
00062 static void
00063 __const_rbegin_iterator_accessor_requirement_violation(const _Container& __c) {
00064 __c.rbegin();
00065 }
00066 template <class _Container>
00067 static void
00068 __rend_iterator_accessor_requirement_violation(_Container __c) {
00069 __c.rend();
00070 }
00071 template <class _Container>
00072 static void
00073 __const_rend_iterator_accessor_requirement_violation(const _Container& __c) {
00074 __c.rend();
00075 }
00076 template <class _Container>
00077 static void
00078 __size_function_must_be_const(const _Container& __c) {
00079 __c.size();
00080 }
00081 template <class _Container>
00082 static void
00083 __size_function_requirement_violation(_Container& __c) {
00084 __c.size();
00085 __size_function_must_be_const(__c);
00086 }
00087 template <class _Container>
00088 static void
00089 __max_size_function_must_be_const(const _Container& __c) {
00090 __c.max_size();
00091 }
00092 template <class _Container>
00093 static void
00094 __max_size_function_requirement_violation(_Container& __c) {
00095 __c.max_size();
00096 __max_size_function_must_be_const(__c);
00097 }
00098 template <class _Container>
00099 static void
00100 __empty_function_must_be_const(const _Container& __c) {
00101 __c.empty();
00102 }
00103 template <class _Container>
00104 static void
00105 __empty_function_requirement_violation(_Container& __c) {
00106 __c.empty();
00107 __empty_function_must_be_const(__c);
00108 }
00109 template <class _Container>
00110 static void
00111 __swap_function_requirement_violation(_Container& __c) {
00112 __c.swap(__c);
00113 }
00114
00115 };
00116
00117
00118 __STL_TYPEDEF_REQUIREMENT(iterator);
00119 __STL_TYPEDEF_REQUIREMENT(const_iterator);
00120
00121
00122
00123 template <class _Container>
00124 struct _Container_concept_specification {
00125 static void
00126 _Container_requirement_violation(_Container __c) {
00127
00128 _Assignable_concept_specification<_Container>::_Assignable_requirement_violation(__c);
00129
00130 __value_type__typedef_requirement_violation<_Container>();
00131 __difference_type__typedef_requirement_violation<_Container>();
00132 __size_type__typedef_requirement_violation<_Container>();
00133 __reference__typedef_requirement_violation<_Container>();
00134 __const_reference__typedef_requirement_violation<_Container>();
00135 __pointer__typedef_requirement_violation<_Container>();
00136 __const_pointer__typedef_requirement_violation<_Container>();
00137 __iterator__typedef_requirement_violation<_Container>();
00138 __const_iterator__typedef_requirement_violation<_Container>();
00139
00140 _ERROR_IN_STL_CONTAINER::__const_begin_iterator_accessor_requirement_violation(__c);
00141 _ERROR_IN_STL_CONTAINER::__const_end_iterator_accessor_requirement_violation(__c);
00142 _ERROR_IN_STL_CONTAINER::__begin_iterator_accessor_requirement_violation(__c);
00143 _ERROR_IN_STL_CONTAINER::__end_iterator_accessor_requirement_violation(__c);
00144 _ERROR_IN_STL_CONTAINER::__size_function_requirement_violation(__c);
00145 _ERROR_IN_STL_CONTAINER::__max_size_function_requirement_violation(__c);
00146 _ERROR_IN_STL_CONTAINER::__empty_function_requirement_violation(__c);
00147 _ERROR_IN_STL_CONTAINER::__swap_function_requirement_violation(__c);
00148
00149 typedef typename _Container::iterator iter;
00150 typedef typename _Container::const_iterator const_iter;
00151 _InputIterator_concept_specification<const_iter>::_InputIterator_requirement_violation(const_iter());
00152 _InputIterator_concept_specification<iter>::_InputIterator_requirement_violation(iter());
00153 }
00154 };
00155
00156 template <class _ForwardContainer>
00157 struct _ForwardContainer_concept_specification {
00158 static void
00159 _ForwardContainer_requirement_violation(_ForwardContainer __c) {
00160
00161 _Container_concept_specification<_ForwardContainer>::_Container_requirement_violation(__c);
00162
00163 typedef typename _ForwardContainer::iterator iter;
00164 typedef typename _ForwardContainer::const_iterator const_iter;
00165 _ForwardIterator_concept_specification<const_iter>::_ForwardIterator_requirement_violation(const_iter());
00166 _Mutable_ForwardIterator_concept_specification<iter>::_Mutable_ForwardIterator_requirement_violation(iter());
00167 }
00168 };
00169
00170
00171 __STL_TYPEDEF_REQUIREMENT(reverse_iterator);
00172 __STL_TYPEDEF_REQUIREMENT(const_reverse_iterator);
00173
00174 template <class _ReversibleContainer>
00175 struct _ReversibleContainer_concept_specification {
00176 static void
00177 _ReversibleContainer_requirement_violation(_ReversibleContainer __c) {
00178
00179 _ForwardContainer_concept_specification<_ReversibleContainer>::_ForwardContainer_requirement_violation(__c);
00180
00181 __reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
00182 __const_reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
00183
00184 _ERROR_IN_STL_CONTAINER::__const_rbegin_iterator_accessor_requirement_violation(__c);
00185 _ERROR_IN_STL_CONTAINER::__const_rend_iterator_accessor_requirement_violation(__c);
00186 _ERROR_IN_STL_CONTAINER::__rbegin_iterator_accessor_requirement_violation(__c);
00187 _ERROR_IN_STL_CONTAINER::__rend_iterator_accessor_requirement_violation(__c);
00188
00189 typedef typename _ReversibleContainer::iterator iter;
00190 typedef typename _ReversibleContainer::const_iterator const_iter;
00191 _BidirectionalIterator_concept_specification<const_iter>::_BidirectionalIterator_requirement_violation(const_iter());
00192 _Mutable_BidirectionalIterator_concept_specification<iter>::_Mutable_BidirectionalIterator_requirement_violation(iter());
00193 }
00194 };
00195
00196 template <class _ReversibleContainer>
00197 struct _const_ReversibleContainer_concept_specification {
00198 static void
00199 _const_ReversibleContainer_requirement_violation(_ReversibleContainer __c) {
00200
00201 _Container_concept_specification<_ReversibleContainer>::_Container_requirement_violation(__c);
00202
00203 __reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
00204 __const_reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
00205
00206 _ERROR_IN_STL_CONTAINER::__const_rbegin_iterator_accessor_requirement_violation(__c);
00207 _ERROR_IN_STL_CONTAINER::__const_rend_iterator_accessor_requirement_violation(__c);
00208 _ERROR_IN_STL_CONTAINER::__rbegin_iterator_accessor_requirement_violation(__c);
00209 _ERROR_IN_STL_CONTAINER::__rend_iterator_accessor_requirement_violation(__c);
00210
00211 typedef typename _ReversibleContainer::iterator iter;
00212 typedef typename _ReversibleContainer::const_iterator const_iter;
00213
00214
00215 #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 91)
00216 __BidirectionalIterator_concept_specification<const_iter>::_BidirectionalIterator_requirement_violation(const_iter());
00217 #endif
00218 }
00219 };
00220
00221
00222 template <class _RandomAccessContainer>
00223 struct _RandomAccessContainer_concept_specification {
00224 static void
00225 _RandomAccessContainer_requirement_violation(_RandomAccessContainer __c) {
00226
00227 _ReversibleContainer_concept_specification<_RandomAccessContainer>::_ReversibleContainer_requirement_violation(__c);
00228
00229 typedef typename _RandomAccessContainer::value_type __T;
00230 typedef typename _RandomAccessContainer::difference_type _Dist;
00231 typedef typename _Mutable_trait<__T>::_Type Type;
00232 typedef Type* _TypePtr;
00233 typedef typename _Mutable_trait<_Dist>::_Type Dist;
00234 _STL_ERROR::__element_access_operator_requirement_violation(__c,
00235 _TypePtr(),
00236 Dist());
00237
00238 typedef typename _RandomAccessContainer::iterator iter;
00239 typedef typename _RandomAccessContainer::const_iterator const_iter;
00240 _RandomAccessIterator_concept_specification<const_iter>::_RandomAccessIterator_requirement_violation(const_iter());
00241 _Mutable_RandomAccessIterator_concept_specification<iter>::_Mutable_RandomAccessIterator_requirement_violation(iter());
00242 }
00243 };
00244
00245 #endif
00246
00247 #endif