00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _GLIBCPP_BOOST_CONCEPT_CHECK
00011 #define _GLIBCPP_BOOST_CONCEPT_CHECK 1
00012
00013 #pragma GCC system_header
00014 #include <bits/stl_iterator_base_types.h>
00015 #include <utility>
00016
00017
00018 namespace __gnu_cxx
00019 {
00020
00021 #define _IsUnused __attribute__ ((__unused__))
00022
00023 template <class _Concept>
00024 void __function_requires()
00025 {
00026 void (_Concept::*__x)() _IsUnused = &_Concept::__constraints;
00027 }
00028
00029
00030
00031 #define _GLIBCPP_CLASS_REQUIRES(_type_var, _ns, _concept) \
00032 typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \
00033 template <_func##_type_var##_concept _Tp1> \
00034 struct _concept_checking##_type_var##_concept { }; \
00035 typedef _concept_checking##_type_var##_concept< \
00036 &_ns::_concept <_type_var>::__constraints> \
00037 _concept_checking_typedef##_type_var##_concept
00038
00039 #define _GLIBCPP_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \
00040 typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \
00041 template <_func##_type_var1##_type_var2##_concept _Tp1> \
00042 struct _concept_checking##_type_var1##_type_var2##_concept { }; \
00043 typedef _concept_checking##_type_var1##_type_var2##_concept< \
00044 &_ns::_concept <_type_var1,_type_var2>::__constraints> \
00045 _concept_checking_typedef##_type_var1##_type_var2##_concept
00046
00047 #define _GLIBCPP_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \
00048 typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \
00049 template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \
00050 struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \
00051 typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \
00052 &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints> \
00053 _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept
00054
00055 #define _GLIBCPP_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \
00056 typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \
00057 template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \
00058 struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \
00059 typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \
00060 &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \
00061 _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept
00062
00063
00064 template <class _Tp1, class _Tp2>
00065 struct _Aux_require_same { };
00066
00067 template <class _Tp>
00068 struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
00069
00070 template <class _Tp1, class _Tp2>
00071 struct _SameTypeConcept
00072 {
00073 void __constraints() {
00074 typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required;
00075 }
00076 };
00077
00078 template <class _Tp>
00079 struct _IntegerConcept {
00080 void __constraints() {
00081 __error_type_must_be_an_integer_type();
00082 }
00083 };
00084 template <> struct _IntegerConcept<short> { void __constraints() {} };
00085 template <> struct _IntegerConcept<unsigned short> { void __constraints(){} };
00086 template <> struct _IntegerConcept<int> { void __constraints() {} };
00087 template <> struct _IntegerConcept<unsigned int> { void __constraints() {} };
00088 template <> struct _IntegerConcept<long> { void __constraints() {} };
00089 template <> struct _IntegerConcept<unsigned long> { void __constraints() {} };
00090 template <> struct _IntegerConcept<long long> { void __constraints() {} };
00091 template <> struct _IntegerConcept<unsigned long long>
00092 { void __constraints() {} };
00093
00094 template <class _Tp>
00095 struct _SignedIntegerConcept {
00096 void __constraints() {
00097 __error_type_must_be_a_signed_integer_type();
00098 }
00099 };
00100 template <> struct _SignedIntegerConcept<short> { void __constraints() {} };
00101 template <> struct _SignedIntegerConcept<int> { void __constraints() {} };
00102 template <> struct _SignedIntegerConcept<long> { void __constraints() {} };
00103 template <> struct _SignedIntegerConcept<long long> { void __constraints(){}};
00104
00105 template <class _Tp>
00106 struct _UnsignedIntegerConcept {
00107 void __constraints() {
00108 __error_type_must_be_an_unsigned_integer_type();
00109 }
00110 };
00111 template <> struct _UnsignedIntegerConcept<unsigned short>
00112 { void __constraints() {} };
00113 template <> struct _UnsignedIntegerConcept<unsigned int>
00114 { void __constraints() {} };
00115 template <> struct _UnsignedIntegerConcept<unsigned long>
00116 { void __constraints() {} };
00117 template <> struct _UnsignedIntegerConcept<unsigned long long>
00118 { void __constraints() {} };
00119
00120
00121
00122
00123 template <class _Tp>
00124 struct _DefaultConstructibleConcept
00125 {
00126 void __constraints() {
00127 _Tp __a _IsUnused;
00128 }
00129 };
00130
00131 template <class _Tp>
00132 struct _AssignableConcept
00133 {
00134 void __constraints() {
00135 __a = __a;
00136 __const_constraints(__a);
00137 }
00138 void __const_constraints(const _Tp& __b) {
00139 __a = __b;
00140 }
00141 _Tp __a;
00142 };
00143
00144 template <class _Tp>
00145 struct _CopyConstructibleConcept
00146 {
00147 void __constraints() {
00148 _Tp __a(__b);
00149 _Tp* __ptr _IsUnused = &__a;
00150 __const_constraints(__a);
00151 }
00152 void __const_constraints(const _Tp& __a) {
00153 _Tp __c(__a) _IsUnused;
00154 const _Tp* __ptr _IsUnused = &__a;
00155 }
00156 _Tp __b;
00157 };
00158
00159
00160 template <class _Tp>
00161 struct _SGIAssignableConcept
00162 {
00163 void __constraints() {
00164 _Tp __b(__a) _IsUnused;
00165 __a = __a;
00166 __const_constraints(__a);
00167 }
00168 void __const_constraints(const _Tp& __b) {
00169 _Tp __c(__b) _IsUnused;
00170 __a = __b;
00171 }
00172 _Tp __a;
00173 };
00174
00175 template <class _From, class _To>
00176 struct _ConvertibleConcept
00177 {
00178 void __constraints() {
00179 _To __y _IsUnused = __x;
00180 }
00181 _From __x;
00182 };
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193 template <class _Tp>
00194 void __aux_require_boolean_expr(const _Tp& __t) {
00195 bool __x _IsUnused = __t;
00196 }
00197
00198
00199 template <class _Tp>
00200 struct _EqualityComparableConcept
00201 {
00202 void __constraints() {
00203 __aux_require_boolean_expr(__a == __b);
00204 __aux_require_boolean_expr(__a != __b);
00205 }
00206 _Tp __a, __b;
00207 };
00208
00209 template <class _Tp>
00210 struct _LessThanComparableConcept
00211 {
00212 void __constraints() {
00213 __aux_require_boolean_expr(__a < __b);
00214 }
00215 _Tp __a, __b;
00216 };
00217
00218
00219 template <class _Tp>
00220 struct _ComparableConcept
00221 {
00222 void __constraints() {
00223 __aux_require_boolean_expr(__a < __b);
00224 __aux_require_boolean_expr(__a > __b);
00225 __aux_require_boolean_expr(__a <= __b);
00226 __aux_require_boolean_expr(__a >= __b);
00227 }
00228 _Tp __a, __b;
00229 };
00230
00231 #define _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \
00232 template <class _First, class _Second> \
00233 struct _NAME { \
00234 void __constraints() { (void)__constraints_(); } \
00235 bool __constraints_() { \
00236 return __a _OP __b; \
00237 } \
00238 _First __a; \
00239 _Second __b; \
00240 }
00241
00242 #define _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \
00243 template <class _Ret, class _First, class _Second> \
00244 struct _NAME { \
00245 void __constraints() { (void)__constraints_(); } \
00246 _Ret __constraints_() { \
00247 return __a _OP __b; \
00248 } \
00249 _First __a; \
00250 _Second __b; \
00251 }
00252
00253 _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept);
00254 _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept);
00255 _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept);
00256 _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept);
00257 _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept);
00258 _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept);
00259
00260 _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept);
00261 _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept);
00262 _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept);
00263 _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept);
00264 _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept);
00265
00266 #undef _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT
00267 #undef _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT
00268
00269
00270
00271
00272 template <class _Func, class _Return>
00273 struct _GeneratorConcept
00274 {
00275 void __constraints() {
00276 const _Return& __r _IsUnused = __f();
00277 }
00278 _Func __f;
00279 };
00280
00281
00282 template <class _Func>
00283 struct _GeneratorConcept<_Func,void>
00284 {
00285 void __constraints() {
00286 __f();
00287 }
00288 _Func __f;
00289 };
00290
00291 template <class _Func, class _Return, class _Arg>
00292 struct _UnaryFunctionConcept
00293 {
00294 void __constraints() {
00295 __r = __f(__arg);
00296 }
00297 _Func __f;
00298 _Arg __arg;
00299 _Return __r;
00300 };
00301
00302 template <class _Func, class _Arg>
00303 struct _UnaryFunctionConcept<_Func, void, _Arg> {
00304 void __constraints() {
00305 __f(__arg);
00306 }
00307 _Func __f;
00308 _Arg __arg;
00309 };
00310
00311 template <class _Func, class _Return, class _First, class _Second>
00312 struct _BinaryFunctionConcept
00313 {
00314 void __constraints() {
00315 __r = __f(__first, __second);
00316 }
00317 _Func __f;
00318 _First __first;
00319 _Second __second;
00320 _Return __r;
00321 };
00322
00323 template <class _Func, class _First, class _Second>
00324 struct _BinaryFunctionConcept<_Func, void, _First, _Second>
00325 {
00326 void __constraints() {
00327 __f(__first, __second);
00328 }
00329 _Func __f;
00330 _First __first;
00331 _Second __second;
00332 };
00333
00334 template <class _Func, class _Arg>
00335 struct _UnaryPredicateConcept
00336 {
00337 void __constraints() {
00338 __aux_require_boolean_expr(__f(__arg));
00339 }
00340 _Func __f;
00341 _Arg __arg;
00342 };
00343
00344 template <class _Func, class _First, class _Second>
00345 struct _BinaryPredicateConcept
00346 {
00347 void __constraints() {
00348 __aux_require_boolean_expr(__f(__a, __b));
00349 }
00350 _Func __f;
00351 _First __a;
00352 _Second __b;
00353 };
00354
00355
00356 template <class _Func, class _First, class _Second>
00357 struct _Const_BinaryPredicateConcept {
00358 void __constraints() {
00359 __const_constraints(__f);
00360 }
00361 void __const_constraints(const _Func& __fun) {
00362 __function_requires<_BinaryPredicateConcept<_Func, _First, _Second> >();
00363
00364 __aux_require_boolean_expr(__fun(__a, __b));
00365 }
00366 _Func __f;
00367 _First __a;
00368 _Second __b;
00369 };
00370
00371
00372
00373
00374 template <class _Tp>
00375 struct _TrivialIteratorConcept
00376 {
00377 void __constraints() {
00378 __function_requires< _DefaultConstructibleConcept<_Tp> >();
00379 __function_requires< _AssignableConcept<_Tp> >();
00380 __function_requires< _EqualityComparableConcept<_Tp> >();
00381 typedef typename std::iterator_traits<_Tp>::value_type _V;
00382 (void)*__i;
00383 }
00384 _Tp __i;
00385 };
00386
00387 template <class _Tp>
00388 struct _Mutable_TrivialIteratorConcept
00389 {
00390 void __constraints() {
00391 __function_requires< _TrivialIteratorConcept<_Tp> >();
00392 *__i = *__j;
00393 }
00394 _Tp __i, __j;
00395 };
00396
00397 template <class _Tp>
00398 struct _InputIteratorConcept
00399 {
00400 void __constraints() {
00401 __function_requires< _TrivialIteratorConcept<_Tp> >();
00402
00403 typedef typename std::iterator_traits<_Tp>::difference_type _D;
00404 __function_requires< _SignedIntegerConcept<_D> >();
00405 typedef typename std::iterator_traits<_Tp>::reference _R;
00406 typedef typename std::iterator_traits<_Tp>::pointer _Pt;
00407 typedef typename std::iterator_traits<_Tp>::iterator_category _Cat;
00408 __function_requires< _ConvertibleConcept<
00409 typename std::iterator_traits<_Tp>::iterator_category,
00410 std::input_iterator_tag> >();
00411 ++__i;
00412 __i++;
00413 }
00414 _Tp __i;
00415 };
00416
00417 template <class _Tp, class _ValueT>
00418 struct _OutputIteratorConcept
00419 {
00420 void __constraints() {
00421 __function_requires< _AssignableConcept<_Tp> >();
00422 ++__i;
00423 __i++;
00424 *__i++ = __t;
00425 }
00426 _Tp __i;
00427 _ValueT __t;
00428 };
00429
00430 template <class _Tp>
00431 struct _ForwardIteratorConcept
00432 {
00433 void __constraints() {
00434 __function_requires< _InputIteratorConcept<_Tp> >();
00435 __function_requires< _ConvertibleConcept<
00436 typename std::iterator_traits<_Tp>::iterator_category,
00437 std::forward_iterator_tag> >();
00438 typedef typename std::iterator_traits<_Tp>::reference _R;
00439 _R __r _IsUnused = *__i;
00440 }
00441 _Tp __i;
00442 };
00443
00444 template <class _Tp>
00445 struct _Mutable_ForwardIteratorConcept
00446 {
00447 void __constraints() {
00448 __function_requires< _ForwardIteratorConcept<_Tp> >();
00449 *__i++ = *__i;
00450 }
00451 _Tp __i;
00452 };
00453
00454 template <class _Tp>
00455 struct _BidirectionalIteratorConcept
00456 {
00457 void __constraints() {
00458 __function_requires< _ForwardIteratorConcept<_Tp> >();
00459 __function_requires< _ConvertibleConcept<
00460 typename std::iterator_traits<_Tp>::iterator_category,
00461 std::bidirectional_iterator_tag> >();
00462 --__i;
00463 __i--;
00464 }
00465 _Tp __i;
00466 };
00467
00468 template <class _Tp>
00469 struct _Mutable_BidirectionalIteratorConcept
00470 {
00471 void __constraints() {
00472 __function_requires< _BidirectionalIteratorConcept<_Tp> >();
00473 __function_requires< _Mutable_ForwardIteratorConcept<_Tp> >();
00474 *__i-- = *__i;
00475 }
00476 _Tp __i;
00477 };
00478
00479
00480 template <class _Tp>
00481 struct _RandomAccessIteratorConcept
00482 {
00483 void __constraints() {
00484 __function_requires< _BidirectionalIteratorConcept<_Tp> >();
00485 __function_requires< _ComparableConcept<_Tp> >();
00486 __function_requires< _ConvertibleConcept<
00487 typename std::iterator_traits<_Tp>::iterator_category,
00488 std::random_access_iterator_tag> >();
00489
00490 typedef typename std::iterator_traits<_Tp>::reference _R;
00491
00492 __i += __n;
00493 __i = __i + __n; __i = __n + __i;
00494 __i -= __n;
00495 __i = __i - __n;
00496
00497 __n = __i - __j;
00498 (void)__i[__n];
00499 }
00500 _Tp __a, __b;
00501 _Tp __i, __j;
00502 typename std::iterator_traits<_Tp>::difference_type __n;
00503 };
00504
00505 template <class _Tp>
00506 struct _Mutable_RandomAccessIteratorConcept
00507 {
00508 void __constraints() {
00509 __function_requires< _RandomAccessIteratorConcept<_Tp> >();
00510 __function_requires< _Mutable_BidirectionalIteratorConcept<_Tp> >();
00511 __i[__n] = *__i;
00512 }
00513 _Tp __i;
00514 typename std::iterator_traits<_Tp>::difference_type __n;
00515 };
00516
00517
00518
00519
00520 template <class _Container>
00521 struct _ContainerConcept
00522 {
00523 typedef typename _Container::value_type _Value_type;
00524 typedef typename _Container::difference_type _Difference_type;
00525 typedef typename _Container::size_type _Size_type;
00526 typedef typename _Container::const_reference _Const_reference;
00527 typedef typename _Container::const_pointer _Const_pointer;
00528 typedef typename _Container::const_iterator _Const_iterator;
00529
00530 void __constraints() {
00531 __function_requires< _InputIteratorConcept<_Const_iterator> >();
00532 __function_requires< _AssignableConcept<_Container> >();
00533 const _Container __c;
00534 __i = __c.begin();
00535 __i = __c.end();
00536 __n = __c.size();
00537 __n = __c.max_size();
00538 __b = __c.empty();
00539 }
00540 bool __b;
00541 _Const_iterator __i;
00542 _Size_type __n;
00543 };
00544
00545 template <class _Container>
00546 struct _Mutable_ContainerConcept
00547 {
00548 typedef typename _Container::value_type _Value_type;
00549 typedef typename _Container::reference _Reference;
00550 typedef typename _Container::iterator _Iterator;
00551 typedef typename _Container::pointer _Pointer;
00552
00553 void __constraints() {
00554 __function_requires< _ContainerConcept<_Container> >();
00555 __function_requires< _AssignableConcept<_Value_type> >();
00556 __function_requires< _InputIteratorConcept<_Iterator> >();
00557
00558 __i = __c.begin();
00559 __i = __c.end();
00560 __c.swap(__c2);
00561 }
00562 _Iterator __i;
00563 _Container __c, __c2;
00564 };
00565
00566 template <class _ForwardContainer>
00567 struct _ForwardContainerConcept
00568 {
00569 void __constraints() {
00570 __function_requires< _ContainerConcept<_ForwardContainer> >();
00571 typedef typename _ForwardContainer::const_iterator _Const_iterator;
00572 __function_requires< _ForwardIteratorConcept<_Const_iterator> >();
00573 }
00574 };
00575
00576 template <class _ForwardContainer>
00577 struct _Mutable_ForwardContainerConcept
00578 {
00579 void __constraints() {
00580 __function_requires< _ForwardContainerConcept<_ForwardContainer> >();
00581 __function_requires< _Mutable_ContainerConcept<_ForwardContainer> >();
00582 typedef typename _ForwardContainer::iterator _Iterator;
00583 __function_requires< _Mutable_ForwardIteratorConcept<_Iterator> >();
00584 }
00585 };
00586
00587 template <class _ReversibleContainer>
00588 struct _ReversibleContainerConcept
00589 {
00590 typedef typename _ReversibleContainer::const_iterator _Const_iterator;
00591 typedef typename _ReversibleContainer::const_reverse_iterator
00592 _Const_reverse_iterator;
00593
00594 void __constraints() {
00595 __function_requires< _ForwardContainerConcept<_ReversibleContainer> >();
00596 __function_requires< _BidirectionalIteratorConcept<_Const_iterator> >();
00597 __function_requires<
00598 _BidirectionalIteratorConcept<_Const_reverse_iterator> >();
00599
00600 const _ReversibleContainer __c;
00601 _Const_reverse_iterator __i = __c.rbegin();
00602 __i = __c.rend();
00603 }
00604 };
00605
00606 template <class _ReversibleContainer>
00607 struct _Mutable_ReversibleContainerConcept
00608 {
00609 typedef typename _ReversibleContainer::iterator _Iterator;
00610 typedef typename _ReversibleContainer::reverse_iterator _Reverse_iterator;
00611
00612 void __constraints() {
00613 __function_requires<_ReversibleContainerConcept<_ReversibleContainer> >();
00614 __function_requires<
00615 _Mutable_ForwardContainerConcept<_ReversibleContainer> >();
00616 __function_requires<_Mutable_BidirectionalIteratorConcept<_Iterator> >();
00617 __function_requires<
00618 _Mutable_BidirectionalIteratorConcept<_Reverse_iterator> >();
00619
00620 _Reverse_iterator __i = __c.rbegin();
00621 __i = __c.rend();
00622 }
00623 _ReversibleContainer __c;
00624 };
00625
00626 template <class _RandomAccessContainer>
00627 struct _RandomAccessContainerConcept
00628 {
00629 typedef typename _RandomAccessContainer::size_type _Size_type;
00630 typedef typename _RandomAccessContainer::const_reference _Const_reference;
00631 typedef typename _RandomAccessContainer::const_iterator _Const_iterator;
00632 typedef typename _RandomAccessContainer::const_reverse_iterator
00633 _Const_reverse_iterator;
00634
00635 void __constraints() {
00636 __function_requires<
00637 _ReversibleContainerConcept<_RandomAccessContainer> >();
00638 __function_requires< _RandomAccessIteratorConcept<_Const_iterator> >();
00639 __function_requires<
00640 _RandomAccessIteratorConcept<_Const_reverse_iterator> >();
00641
00642 const _RandomAccessContainer __c;
00643 _Const_reference __r _IsUnused = __c[__n];
00644 }
00645 _Size_type __n;
00646 };
00647
00648 template <class _RandomAccessContainer>
00649 struct _Mutable_RandomAccessContainerConcept
00650 {
00651 typedef typename _RandomAccessContainer::size_type _Size_type;
00652 typedef typename _RandomAccessContainer::reference _Reference;
00653 typedef typename _RandomAccessContainer::iterator _Iterator;
00654 typedef typename _RandomAccessContainer::reverse_iterator _Reverse_iterator;
00655
00656 void __constraints() {
00657 __function_requires<
00658 _RandomAccessContainerConcept<_RandomAccessContainer> >();
00659 __function_requires<
00660 _Mutable_ReversibleContainerConcept<_RandomAccessContainer> >();
00661 __function_requires< _Mutable_RandomAccessIteratorConcept<_Iterator> >();
00662 __function_requires<
00663 _Mutable_RandomAccessIteratorConcept<_Reverse_iterator> >();
00664
00665 _Reference __r _IsUnused = __c[__i];
00666 }
00667 _Size_type __i;
00668 _RandomAccessContainer __c;
00669 };
00670
00671
00672 template <class _Sequence>
00673 struct _SequenceConcept
00674 {
00675 typedef typename _Sequence::reference _Reference;
00676 typedef typename _Sequence::const_reference _Const_reference;
00677
00678 void __constraints() {
00679
00680
00681
00682 __function_requires< _Mutable_ForwardContainerConcept<_Sequence> >();
00683 __function_requires< _DefaultConstructibleConcept<_Sequence> >();
00684
00685 _Sequence
00686 __c(__n) _IsUnused,
00687 __c2(__n, __t) _IsUnused,
00688 __c3(__first, __last) _IsUnused;
00689
00690 __c.insert(__p, __t);
00691 __c.insert(__p, __n, __t);
00692 __c.insert(__p, __first, __last);
00693
00694 __c.erase(__p);
00695 __c.erase(__p, __q);
00696
00697 _Reference __r _IsUnused = __c.front();
00698
00699 __const_constraints(__c);
00700 }
00701 void __const_constraints(const _Sequence& __c) {
00702 _Const_reference __r _IsUnused = __c.front();
00703 }
00704 typename _Sequence::value_type __t;
00705 typename _Sequence::size_type __n;
00706 typename _Sequence::value_type *__first, *__last;
00707 typename _Sequence::iterator __p, __q;
00708 };
00709
00710 template <class _FrontInsertionSequence>
00711 struct _FrontInsertionSequenceConcept
00712 {
00713 void __constraints() {
00714 __function_requires< _SequenceConcept<_FrontInsertionSequence> >();
00715
00716 __c.push_front(__t);
00717 __c.pop_front();
00718 }
00719 _FrontInsertionSequence __c;
00720 typename _FrontInsertionSequence::value_type __t;
00721 };
00722
00723 template <class _BackInsertionSequence>
00724 struct _BackInsertionSequenceConcept
00725 {
00726 typedef typename _BackInsertionSequence::reference _Reference;
00727 typedef typename _BackInsertionSequence::const_reference _Const_reference;
00728
00729 void __constraints() {
00730 __function_requires< _SequenceConcept<_BackInsertionSequence> >();
00731
00732 __c.push_back(__t);
00733 __c.pop_back();
00734 _Reference __r _IsUnused = __c.back();
00735 }
00736 void __const_constraints(const _BackInsertionSequence& __c) {
00737 _Const_reference __r _IsUnused = __c.back();
00738 };
00739 _BackInsertionSequence __c;
00740 typename _BackInsertionSequence::value_type __t;
00741 };
00742
00743 template <class _AssociativeContainer>
00744 struct _AssociativeContainerConcept
00745 {
00746 void __constraints() {
00747 __function_requires< _ForwardContainerConcept<_AssociativeContainer> >();
00748 __function_requires<
00749 _DefaultConstructibleConcept<_AssociativeContainer> >();
00750
00751 __i = __c.find(__k);
00752 __r = __c.equal_range(__k);
00753 __c.erase(__k);
00754 __c.erase(__i);
00755 __c.erase(__r.first, __r.second);
00756 __const_constraints(__c);
00757 }
00758 void __const_constraints(const _AssociativeContainer& __c) {
00759 __ci = __c.find(__k);
00760 __n = __c.count(__k);
00761 __cr = __c.equal_range(__k);
00762 }
00763 typedef typename _AssociativeContainer::iterator _Iterator;
00764 typedef typename _AssociativeContainer::const_iterator _Const_iterator;
00765
00766 _AssociativeContainer __c;
00767 _Iterator __i;
00768 std::pair<_Iterator,_Iterator> __r;
00769 _Const_iterator __ci;
00770 std::pair<_Const_iterator,_Const_iterator> __cr;
00771 typename _AssociativeContainer::key_type __k;
00772 typename _AssociativeContainer::size_type __n;
00773 };
00774
00775 template <class _UniqueAssociativeContainer>
00776 struct _UniqueAssociativeContainerConcept
00777 {
00778 void __constraints() {
00779 __function_requires<
00780 _AssociativeContainerConcept<_UniqueAssociativeContainer> >();
00781
00782 _UniqueAssociativeContainer __c(__first, __last);
00783
00784 __pos_flag = __c.insert(__t);
00785 __c.insert(__first, __last);
00786 }
00787 std::pair<typename _UniqueAssociativeContainer::iterator, bool> __pos_flag;
00788 typename _UniqueAssociativeContainer::value_type __t;
00789 typename _UniqueAssociativeContainer::value_type *__first, *__last;
00790 };
00791
00792 template <class _MultipleAssociativeContainer>
00793 struct _MultipleAssociativeContainerConcept
00794 {
00795 void __constraints() {
00796 __function_requires<
00797 _AssociativeContainerConcept<_MultipleAssociativeContainer> >();
00798
00799 _MultipleAssociativeContainer __c(__first, __last);
00800
00801 __pos = __c.insert(__t);
00802 __c.insert(__first, __last);
00803
00804 }
00805 typename _MultipleAssociativeContainer::iterator __pos _IsUnused;
00806 typename _MultipleAssociativeContainer::value_type __t;
00807 typename _MultipleAssociativeContainer::value_type *__first, *__last;
00808 };
00809
00810 template <class _SimpleAssociativeContainer>
00811 struct _SimpleAssociativeContainerConcept
00812 {
00813 void __constraints() {
00814 __function_requires<
00815 _AssociativeContainerConcept<_SimpleAssociativeContainer> >();
00816 typedef typename _SimpleAssociativeContainer::key_type _Key_type;
00817 typedef typename _SimpleAssociativeContainer::value_type _Value_type;
00818 typedef typename _Aux_require_same<_Key_type, _Value_type>::_Type
00819 _Requqired;
00820 }
00821 };
00822
00823 template <class _SimpleAssociativeContainer>
00824 struct _PairAssociativeContainerConcept
00825 {
00826 void __constraints() {
00827 __function_requires<
00828 _AssociativeContainerConcept<_SimpleAssociativeContainer> >();
00829 typedef typename _SimpleAssociativeContainer::key_type _Key_type;
00830 typedef typename _SimpleAssociativeContainer::value_type _Value_type;
00831 typedef typename _SimpleAssociativeContainer::mapped_type _Mapped_type;
00832 typedef std::pair<const _Key_type, _Mapped_type> _Required_value_type;
00833 typedef typename _Aux_require_same<_Value_type,
00834 _Required_value_type>::_Type _Required;
00835 }
00836 };
00837
00838 template <class _SortedAssociativeContainer>
00839 struct _SortedAssociativeContainerConcept
00840 {
00841 void __constraints() {
00842 __function_requires<
00843 _AssociativeContainerConcept<_SortedAssociativeContainer> >();
00844 __function_requires<
00845 _ReversibleContainerConcept<_SortedAssociativeContainer> >();
00846
00847 _SortedAssociativeContainer
00848 __c(__kc) _IsUnused,
00849 __c2(__first, __last) _IsUnused,
00850 __c3(__first, __last, __kc) _IsUnused;
00851
00852 __p = __c.upper_bound(__k);
00853 __p = __c.lower_bound(__k);
00854 __r = __c.equal_range(__k);
00855
00856 __c.insert(__p, __t);
00857 }
00858 void __const_constraints(const _SortedAssociativeContainer& __c) {
00859 __kc = __c.key_comp();
00860 __vc = __c.value_comp();
00861
00862 __cp = __c.upper_bound(__k);
00863 __cp = __c.lower_bound(__k);
00864 __cr = __c.equal_range(__k);
00865 }
00866 typename _SortedAssociativeContainer::key_compare __kc;
00867 typename _SortedAssociativeContainer::value_compare __vc;
00868 typename _SortedAssociativeContainer::value_type __t;
00869 typename _SortedAssociativeContainer::key_type __k;
00870 typedef typename _SortedAssociativeContainer::iterator _Iterator;
00871 typedef typename _SortedAssociativeContainer::const_iterator
00872 _Const_iterator;
00873
00874 _Iterator __p;
00875 _Const_iterator __cp;
00876 std::pair<_Iterator,_Iterator> __r;
00877 std::pair<_Const_iterator,_Const_iterator> __cr;
00878 typename _SortedAssociativeContainer::value_type *__first, *__last;
00879 };
00880
00881
00882
00883 }
00884
00885 #undef _IsUnused
00886
00887 #endif // _GLIBCPP_BOOST_CONCEPT_CHECK
00888
00889