2 // (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
3 // sell and distribute this software is granted provided this
4 // copyright notice appears in all copies. This software is provided
5 // "as is" without express or implied warranty, and with no claim as
6 // to its suitability for any purpose.
9 // GCC Note: based on version 1.12.0 of the Boost library.
11 /** @file boost_concept_check.h
12 * This is an internal header file, included by other library headers.
13 * You should not attempt to use it directly.
16 #ifndef _BOOST_CONCEPT_CHECK_H
17 #define _BOOST_CONCEPT_CHECK_H 1
19 #pragma GCC system_header
21 #include <cstddef> // for ptrdiff_t, used next
22 #include <bits/stl_iterator_base_types.h> // for traits and tags
23 #include <utility> // for pair<>
28 #define _IsUnused __attribute__ ((__unused__))
30 // When the C-C code is in use, we would like this function to do as little
31 // as possible at runtime, use as few resources as possible, and hopefully
32 // be elided out of existence... hmmm.
33 template <class _Concept
>
34 inline void __function_requires()
36 void (_Concept::*__x
)() _IsUnused
= &_Concept::__constraints
;
39 // No definition: if this is referenced, there's a problem with
40 // the instantiating type not being one of the required integer types.
41 // Unfortunately, this results in a link-time error, not a compile-time error.
42 void __error_type_must_be_an_integer_type();
43 void __error_type_must_be_an_unsigned_integer_type();
44 void __error_type_must_be_a_signed_integer_type();
46 // ??? Should the "concept_checking*" structs begin with more than _ ?
47 #define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \
48 typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \
49 template <_func##_type_var##_concept _Tp1> \
50 struct _concept_checking##_type_var##_concept { }; \
51 typedef _concept_checking##_type_var##_concept< \
52 &_ns::_concept <_type_var>::__constraints> \
53 _concept_checking_typedef##_type_var##_concept
55 #define _GLIBCXX_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \
56 typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \
57 template <_func##_type_var1##_type_var2##_concept _Tp1> \
58 struct _concept_checking##_type_var1##_type_var2##_concept { }; \
59 typedef _concept_checking##_type_var1##_type_var2##_concept< \
60 &_ns::_concept <_type_var1,_type_var2>::__constraints> \
61 _concept_checking_typedef##_type_var1##_type_var2##_concept
63 #define _GLIBCXX_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \
64 typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \
65 template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \
66 struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \
67 typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \
68 &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints> \
69 _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept
71 #define _GLIBCXX_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \
72 typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \
73 template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \
74 struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \
75 typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \
76 &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \
77 _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept
80 template <class _Tp1
, class _Tp2
>
81 struct _Aux_require_same
{ };
84 struct _Aux_require_same
<_Tp
,_Tp
> { typedef _Tp _Type
; };
86 template <class _Tp1
, class _Tp2
>
87 struct _SameTypeConcept
89 void __constraints() {
90 typedef typename _Aux_require_same
<_Tp1
, _Tp2
>::_Type _Required
;
95 struct _IntegerConcept
{
96 void __constraints() {
97 __error_type_must_be_an_integer_type();
100 template <> struct _IntegerConcept
<short> { void __constraints() {} };
101 template <> struct _IntegerConcept
<unsigned short> { void __constraints(){} };
102 template <> struct _IntegerConcept
<int> { void __constraints() {} };
103 template <> struct _IntegerConcept
<unsigned int> { void __constraints() {} };
104 template <> struct _IntegerConcept
<long> { void __constraints() {} };
105 template <> struct _IntegerConcept
<unsigned long> { void __constraints() {} };
106 template <> struct _IntegerConcept
<long long> { void __constraints() {} };
107 template <> struct _IntegerConcept
<unsigned long long>
108 { void __constraints() {} };
111 struct _SignedIntegerConcept
{
112 void __constraints() {
113 __error_type_must_be_a_signed_integer_type();
116 template <> struct _SignedIntegerConcept
<short> { void __constraints() {} };
117 template <> struct _SignedIntegerConcept
<int> { void __constraints() {} };
118 template <> struct _SignedIntegerConcept
<long> { void __constraints() {} };
119 template <> struct _SignedIntegerConcept
<long long> { void __constraints(){}};
122 struct _UnsignedIntegerConcept
{
123 void __constraints() {
124 __error_type_must_be_an_unsigned_integer_type();
127 template <> struct _UnsignedIntegerConcept
<unsigned short>
128 { void __constraints() {} };
129 template <> struct _UnsignedIntegerConcept
<unsigned int>
130 { void __constraints() {} };
131 template <> struct _UnsignedIntegerConcept
<unsigned long>
132 { void __constraints() {} };
133 template <> struct _UnsignedIntegerConcept
<unsigned long long>
134 { void __constraints() {} };
136 //===========================================================================
140 struct _DefaultConstructibleConcept
142 void __constraints() {
143 _Tp __a _IsUnused
; // require default constructor
148 struct _AssignableConcept
150 void __constraints() {
151 __a
= __a
; // require assignment operator
152 __const_constraints(__a
);
154 void __const_constraints(const _Tp
& __b
) {
155 __a
= __b
; // const required for argument to assignment
158 // possibly should be "Tp* a;" and then dereference "a" in constraint
159 // functions? present way would require a default ctor, i think...
163 struct _CopyConstructibleConcept
165 void __constraints() {
166 _Tp
__a(__b
); // require copy constructor
167 _Tp
* __ptr _IsUnused
= &__a
; // require address of operator
168 __const_constraints(__a
);
170 void __const_constraints(const _Tp
& __a
) {
171 _Tp
__c(__a
) _IsUnused
; // require const copy constructor
172 const _Tp
* __ptr _IsUnused
= &__a
; // require const address of operator
177 // The SGI STL version of Assignable requires copy constructor and operator=
179 struct _SGIAssignableConcept
181 void __constraints() {
182 _Tp
__b(__a
) _IsUnused
;
183 __a
= __a
; // require assignment operator
184 __const_constraints(__a
);
186 void __const_constraints(const _Tp
& __b
) {
187 _Tp
__c(__b
) _IsUnused
;
188 __a
= __b
; // const required for argument to assignment
193 template <class _From
, class _To
>
194 struct _ConvertibleConcept
196 void __constraints() {
197 _To __y _IsUnused
= __x
;
202 // The C++ standard requirements for many concepts talk about return
203 // types that must be "convertible to bool". The problem with this
204 // requirement is that it leaves the door open for evil proxies that
205 // define things like operator|| with strange return types. Two
206 // possible solutions are:
207 // 1) require the return type to be exactly bool
208 // 2) stay with convertible to bool, and also
209 // specify stuff about all the logical operators.
210 // For now we just test for convertible to bool.
212 void __aux_require_boolean_expr(const _Tp
& __t
) {
213 bool __x _IsUnused
= __t
;
218 struct _EqualityComparableConcept
220 void __constraints() {
221 __aux_require_boolean_expr(__a
== __b
);
227 struct _LessThanComparableConcept
229 void __constraints() {
230 __aux_require_boolean_expr(__a
< __b
);
235 // This is equivalent to SGI STL's LessThanComparable.
237 struct _ComparableConcept
239 void __constraints() {
240 __aux_require_boolean_expr(__a
< __b
);
241 __aux_require_boolean_expr(__a
> __b
);
242 __aux_require_boolean_expr(__a
<= __b
);
243 __aux_require_boolean_expr(__a
>= __b
);
248 #define _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \
249 template <class _First, class _Second> \
251 void __constraints() { (void)__constraints_(); } \
252 bool __constraints_() { \
253 return __a _OP __b; \
259 #define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \
260 template <class _Ret, class _First, class _Second> \
262 void __constraints() { (void)__constraints_(); } \
263 _Ret __constraints_() { \
264 return __a _OP __b; \
270 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept
);
271 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept
);
272 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept
);
273 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept
);
274 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept
);
275 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept
);
277 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept
);
278 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept
);
279 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept
);
280 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept
);
281 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept
);
283 #undef _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT
284 #undef _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT
286 //===========================================================================
287 // Function Object Concepts
289 template <class _Func
, class _Return
>
290 struct _GeneratorConcept
292 void __constraints() {
293 const _Return
& __r _IsUnused
= __f();// require operator() member function
299 template <class _Func
>
300 struct _GeneratorConcept
<_Func
,void>
302 void __constraints() {
303 __f(); // require operator() member function
308 template <class _Func
, class _Return
, class _Arg
>
309 struct _UnaryFunctionConcept
311 void __constraints() {
312 __r
= __f(__arg
); // require operator()
319 template <class _Func
, class _Arg
>
320 struct _UnaryFunctionConcept
<_Func
, void, _Arg
> {
321 void __constraints() {
322 __f(__arg
); // require operator()
328 template <class _Func
, class _Return
, class _First
, class _Second
>
329 struct _BinaryFunctionConcept
331 void __constraints() {
332 __r
= __f(__first
, __second
); // require operator()
340 template <class _Func
, class _First
, class _Second
>
341 struct _BinaryFunctionConcept
<_Func
, void, _First
, _Second
>
343 void __constraints() {
344 __f(__first
, __second
); // require operator()
351 template <class _Func
, class _Arg
>
352 struct _UnaryPredicateConcept
354 void __constraints() {
355 __aux_require_boolean_expr(__f(__arg
)); // require op() returning bool
361 template <class _Func
, class _First
, class _Second
>
362 struct _BinaryPredicateConcept
364 void __constraints() {
365 __aux_require_boolean_expr(__f(__a
, __b
)); // require op() returning bool
372 // use this when functor is used inside a container class like std::set
373 template <class _Func
, class _First
, class _Second
>
374 struct _Const_BinaryPredicateConcept
{
375 void __constraints() {
376 __const_constraints(__f
);
378 void __const_constraints(const _Func
& __fun
) {
379 __function_requires
<_BinaryPredicateConcept
<_Func
, _First
, _Second
> >();
380 // operator() must be a const member function
381 __aux_require_boolean_expr(__fun(__a
, __b
));
388 //===========================================================================
392 struct _TrivialIteratorConcept
394 void __constraints() {
395 __function_requires
< _DefaultConstructibleConcept
<_Tp
> >();
396 __function_requires
< _AssignableConcept
<_Tp
> >();
397 __function_requires
< _EqualityComparableConcept
<_Tp
> >();
398 // typedef typename std::iterator_traits<_Tp>::value_type _V;
399 (void)*__i
; // require dereference operator
405 struct _Mutable_TrivialIteratorConcept
407 void __constraints() {
408 __function_requires
< _TrivialIteratorConcept
<_Tp
> >();
409 *__i
= *__j
; // require dereference and assignment
415 struct _InputIteratorConcept
417 void __constraints() {
418 __function_requires
< _TrivialIteratorConcept
<_Tp
> >();
419 // require iterator_traits typedef's
420 typedef typename
std::iterator_traits
<_Tp
>::difference_type _Diff
;
421 // __function_requires< _SignedIntegerConcept<_Diff> >();
422 typedef typename
std::iterator_traits
<_Tp
>::reference _Ref
;
423 typedef typename
std::iterator_traits
<_Tp
>::pointer _Pt
;
424 typedef typename
std::iterator_traits
<_Tp
>::iterator_category _Cat
;
425 __function_requires
< _ConvertibleConcept
<
426 typename
std::iterator_traits
<_Tp
>::iterator_category
,
427 std::input_iterator_tag
> >();
428 ++__i
; // require preincrement operator
429 __i
++; // require postincrement operator
434 template <class _Tp
, class _ValueT
>
435 struct _OutputIteratorConcept
437 void __constraints() {
438 __function_requires
< _AssignableConcept
<_Tp
> >();
439 ++__i
; // require preincrement operator
440 __i
++; // require postincrement operator
441 *__i
++ = __t
; // require postincrement and assignment
448 struct _ForwardIteratorConcept
450 void __constraints() {
451 __function_requires
< _InputIteratorConcept
<_Tp
> >();
452 __function_requires
< _ConvertibleConcept
<
453 typename
std::iterator_traits
<_Tp
>::iterator_category
,
454 std::forward_iterator_tag
> >();
455 typedef typename
std::iterator_traits
<_Tp
>::reference _Ref
;
456 _Ref __r _IsUnused
= *__i
;
462 struct _Mutable_ForwardIteratorConcept
464 void __constraints() {
465 __function_requires
< _ForwardIteratorConcept
<_Tp
> >();
466 *__i
++ = *__i
; // require postincrement and assignment
472 struct _BidirectionalIteratorConcept
474 void __constraints() {
475 __function_requires
< _ForwardIteratorConcept
<_Tp
> >();
476 __function_requires
< _ConvertibleConcept
<
477 typename
std::iterator_traits
<_Tp
>::iterator_category
,
478 std::bidirectional_iterator_tag
> >();
479 --__i
; // require predecrement operator
480 __i
--; // require postdecrement operator
486 struct _Mutable_BidirectionalIteratorConcept
488 void __constraints() {
489 __function_requires
< _BidirectionalIteratorConcept
<_Tp
> >();
490 __function_requires
< _Mutable_ForwardIteratorConcept
<_Tp
> >();
491 *__i
-- = *__i
; // require postdecrement and assignment
498 struct _RandomAccessIteratorConcept
500 void __constraints() {
501 __function_requires
< _BidirectionalIteratorConcept
<_Tp
> >();
502 __function_requires
< _ComparableConcept
<_Tp
> >();
503 __function_requires
< _ConvertibleConcept
<
504 typename
std::iterator_traits
<_Tp
>::iterator_category
,
505 std::random_access_iterator_tag
> >();
506 // ??? We don't use _Ref, are we just checking for "referenceability"?
507 typedef typename
std::iterator_traits
<_Tp
>::reference _Ref
;
509 __i
+= __n
; // require assignment addition operator
510 __i
= __i
+ __n
; __i
= __n
+ __i
; // require addition with difference type
511 __i
-= __n
; // require assignment subtraction op
512 __i
= __i
- __n
; // require subtraction with
514 __n
= __i
- __j
; // require difference operator
515 (void)__i
[__n
]; // require element access operator
519 typename
std::iterator_traits
<_Tp
>::difference_type __n
;
523 struct _Mutable_RandomAccessIteratorConcept
525 void __constraints() {
526 __function_requires
< _RandomAccessIteratorConcept
<_Tp
> >();
527 __function_requires
< _Mutable_BidirectionalIteratorConcept
<_Tp
> >();
528 __i
[__n
] = *__i
; // require element access and assignment
531 typename
std::iterator_traits
<_Tp
>::difference_type __n
;
534 //===========================================================================
535 // Container Concepts
537 template <class _Container
>
538 struct _ContainerConcept
540 typedef typename
_Container::value_type _Value_type
;
541 typedef typename
_Container::difference_type _Difference_type
;
542 typedef typename
_Container::size_type _Size_type
;
543 typedef typename
_Container::const_reference _Const_reference
;
544 typedef typename
_Container::const_pointer _Const_pointer
;
545 typedef typename
_Container::const_iterator _Const_iterator
;
547 void __constraints() {
548 __function_requires
< _InputIteratorConcept
<_Const_iterator
> >();
549 __function_requires
< _AssignableConcept
<_Container
> >();
550 const _Container __c
;
554 __n
= __c
.max_size();
562 template <class _Container
>
563 struct _Mutable_ContainerConcept
565 typedef typename
_Container::value_type _Value_type
;
566 typedef typename
_Container::reference _Reference
;
567 typedef typename
_Container::iterator _Iterator
;
568 typedef typename
_Container::pointer _Pointer
;
570 void __constraints() {
571 __function_requires
< _ContainerConcept
<_Container
> >();
572 __function_requires
< _AssignableConcept
<_Value_type
> >();
573 __function_requires
< _InputIteratorConcept
<_Iterator
> >();
580 _Container __c
, __c2
;
583 template <class _ForwardContainer
>
584 struct _ForwardContainerConcept
586 void __constraints() {
587 __function_requires
< _ContainerConcept
<_ForwardContainer
> >();
588 typedef typename
_ForwardContainer::const_iterator _Const_iterator
;
589 __function_requires
< _ForwardIteratorConcept
<_Const_iterator
> >();
593 template <class _ForwardContainer
>
594 struct _Mutable_ForwardContainerConcept
596 void __constraints() {
597 __function_requires
< _ForwardContainerConcept
<_ForwardContainer
> >();
598 __function_requires
< _Mutable_ContainerConcept
<_ForwardContainer
> >();
599 typedef typename
_ForwardContainer::iterator _Iterator
;
600 __function_requires
< _Mutable_ForwardIteratorConcept
<_Iterator
> >();
604 template <class _ReversibleContainer
>
605 struct _ReversibleContainerConcept
607 typedef typename
_ReversibleContainer::const_iterator _Const_iterator
;
608 typedef typename
_ReversibleContainer::const_reverse_iterator
609 _Const_reverse_iterator
;
611 void __constraints() {
612 __function_requires
< _ForwardContainerConcept
<_ReversibleContainer
> >();
613 __function_requires
< _BidirectionalIteratorConcept
<_Const_iterator
> >();
615 _BidirectionalIteratorConcept
<_Const_reverse_iterator
> >();
617 const _ReversibleContainer __c
;
618 _Const_reverse_iterator __i
= __c
.rbegin();
623 template <class _ReversibleContainer
>
624 struct _Mutable_ReversibleContainerConcept
626 typedef typename
_ReversibleContainer::iterator _Iterator
;
627 typedef typename
_ReversibleContainer::reverse_iterator _Reverse_iterator
;
629 void __constraints() {
630 __function_requires
<_ReversibleContainerConcept
<_ReversibleContainer
> >();
632 _Mutable_ForwardContainerConcept
<_ReversibleContainer
> >();
633 __function_requires
<_Mutable_BidirectionalIteratorConcept
<_Iterator
> >();
635 _Mutable_BidirectionalIteratorConcept
<_Reverse_iterator
> >();
637 _Reverse_iterator __i
= __c
.rbegin();
640 _ReversibleContainer __c
;
643 template <class _RandomAccessContainer
>
644 struct _RandomAccessContainerConcept
646 typedef typename
_RandomAccessContainer::size_type _Size_type
;
647 typedef typename
_RandomAccessContainer::const_reference _Const_reference
;
648 typedef typename
_RandomAccessContainer::const_iterator _Const_iterator
;
649 typedef typename
_RandomAccessContainer::const_reverse_iterator
650 _Const_reverse_iterator
;
652 void __constraints() {
654 _ReversibleContainerConcept
<_RandomAccessContainer
> >();
655 __function_requires
< _RandomAccessIteratorConcept
<_Const_iterator
> >();
657 _RandomAccessIteratorConcept
<_Const_reverse_iterator
> >();
659 const _RandomAccessContainer __c
;
660 _Const_reference __r _IsUnused
= __c
[__n
];
665 template <class _RandomAccessContainer
>
666 struct _Mutable_RandomAccessContainerConcept
668 typedef typename
_RandomAccessContainer::size_type _Size_type
;
669 typedef typename
_RandomAccessContainer::reference _Reference
;
670 typedef typename
_RandomAccessContainer::iterator _Iterator
;
671 typedef typename
_RandomAccessContainer::reverse_iterator _Reverse_iterator
;
673 void __constraints() {
675 _RandomAccessContainerConcept
<_RandomAccessContainer
> >();
677 _Mutable_ReversibleContainerConcept
<_RandomAccessContainer
> >();
678 __function_requires
< _Mutable_RandomAccessIteratorConcept
<_Iterator
> >();
680 _Mutable_RandomAccessIteratorConcept
<_Reverse_iterator
> >();
682 _Reference __r _IsUnused
= __c
[__i
];
685 _RandomAccessContainer __c
;
688 // A Sequence is inherently mutable
689 template <class _Sequence
>
690 struct _SequenceConcept
692 typedef typename
_Sequence::reference _Reference
;
693 typedef typename
_Sequence::const_reference _Const_reference
;
695 void __constraints() {
696 // Matt Austern's book puts DefaultConstructible here, the C++
697 // standard places it in Container
698 // function_requires< DefaultConstructible<Sequence> >();
699 __function_requires
< _Mutable_ForwardContainerConcept
<_Sequence
> >();
700 __function_requires
< _DefaultConstructibleConcept
<_Sequence
> >();
704 __c2(__n
, __t
) _IsUnused
,
705 __c3(__first
, __last
) _IsUnused
;
707 __c
.insert(__p
, __t
);
708 __c
.insert(__p
, __n
, __t
);
709 __c
.insert(__p
, __first
, __last
);
714 _Reference __r _IsUnused
= __c
.front();
716 __const_constraints(__c
);
718 void __const_constraints(const _Sequence
& __c
) {
719 _Const_reference __r _IsUnused
= __c
.front();
721 typename
_Sequence::value_type __t
;
722 typename
_Sequence::size_type __n
;
723 typename
_Sequence::value_type
*__first
, *__last
;
724 typename
_Sequence::iterator __p
, __q
;
727 template <class _FrontInsertionSequence
>
728 struct _FrontInsertionSequenceConcept
730 void __constraints() {
731 __function_requires
< _SequenceConcept
<_FrontInsertionSequence
> >();
736 _FrontInsertionSequence __c
;
737 typename
_FrontInsertionSequence::value_type __t
;
740 template <class _BackInsertionSequence
>
741 struct _BackInsertionSequenceConcept
743 typedef typename
_BackInsertionSequence::reference _Reference
;
744 typedef typename
_BackInsertionSequence::const_reference _Const_reference
;
746 void __constraints() {
747 __function_requires
< _SequenceConcept
<_BackInsertionSequence
> >();
751 _Reference __r _IsUnused
= __c
.back();
753 void __const_constraints(const _BackInsertionSequence
& __c
) {
754 _Const_reference __r _IsUnused
= __c
.back();
756 _BackInsertionSequence __c
;
757 typename
_BackInsertionSequence::value_type __t
;
760 template <class _AssociativeContainer
>
761 struct _AssociativeContainerConcept
763 void __constraints() {
764 __function_requires
< _ForwardContainerConcept
<_AssociativeContainer
> >();
766 _DefaultConstructibleConcept
<_AssociativeContainer
> >();
769 __r
= __c
.equal_range(__k
);
772 __c
.erase(__r
.first
, __r
.second
);
773 __const_constraints(__c
);
775 void __const_constraints(const _AssociativeContainer
& __c
) {
776 __ci
= __c
.find(__k
);
777 __n
= __c
.count(__k
);
778 __cr
= __c
.equal_range(__k
);
780 typedef typename
_AssociativeContainer::iterator _Iterator
;
781 typedef typename
_AssociativeContainer::const_iterator _Const_iterator
;
783 _AssociativeContainer __c
;
785 std::pair
<_Iterator
,_Iterator
> __r
;
786 _Const_iterator __ci
;
787 std::pair
<_Const_iterator
,_Const_iterator
> __cr
;
788 typename
_AssociativeContainer::key_type __k
;
789 typename
_AssociativeContainer::size_type __n
;
792 template <class _UniqueAssociativeContainer
>
793 struct _UniqueAssociativeContainerConcept
795 void __constraints() {
797 _AssociativeContainerConcept
<_UniqueAssociativeContainer
> >();
799 _UniqueAssociativeContainer
__c(__first
, __last
);
801 __pos_flag
= __c
.insert(__t
);
802 __c
.insert(__first
, __last
);
804 std::pair
<typename
_UniqueAssociativeContainer::iterator
, bool> __pos_flag
;
805 typename
_UniqueAssociativeContainer::value_type __t
;
806 typename
_UniqueAssociativeContainer::value_type
*__first
, *__last
;
809 template <class _MultipleAssociativeContainer
>
810 struct _MultipleAssociativeContainerConcept
812 void __constraints() {
814 _AssociativeContainerConcept
<_MultipleAssociativeContainer
> >();
816 _MultipleAssociativeContainer
__c(__first
, __last
);
818 __pos
= __c
.insert(__t
);
819 __c
.insert(__first
, __last
);
822 typename
_MultipleAssociativeContainer::iterator __pos _IsUnused
;
823 typename
_MultipleAssociativeContainer::value_type __t
;
824 typename
_MultipleAssociativeContainer::value_type
*__first
, *__last
;
827 template <class _SimpleAssociativeContainer
>
828 struct _SimpleAssociativeContainerConcept
830 void __constraints() {
832 _AssociativeContainerConcept
<_SimpleAssociativeContainer
> >();
833 typedef typename
_SimpleAssociativeContainer::key_type _Key_type
;
834 typedef typename
_SimpleAssociativeContainer::value_type _Value_type
;
835 typedef typename _Aux_require_same
<_Key_type
, _Value_type
>::_Type
840 template <class _SimpleAssociativeContainer
>
841 struct _PairAssociativeContainerConcept
843 void __constraints() {
845 _AssociativeContainerConcept
<_SimpleAssociativeContainer
> >();
846 typedef typename
_SimpleAssociativeContainer::key_type _Key_type
;
847 typedef typename
_SimpleAssociativeContainer::value_type _Value_type
;
848 typedef typename
_SimpleAssociativeContainer::mapped_type _Mapped_type
;
849 typedef std::pair
<const _Key_type
, _Mapped_type
> _Required_value_type
;
850 typedef typename _Aux_require_same
<_Value_type
,
851 _Required_value_type
>::_Type _Required
;
855 template <class _SortedAssociativeContainer
>
856 struct _SortedAssociativeContainerConcept
858 void __constraints() {
860 _AssociativeContainerConcept
<_SortedAssociativeContainer
> >();
862 _ReversibleContainerConcept
<_SortedAssociativeContainer
> >();
864 _SortedAssociativeContainer
866 __c2(__first
, __last
) _IsUnused
,
867 __c3(__first
, __last
, __kc
) _IsUnused
;
869 __p
= __c
.upper_bound(__k
);
870 __p
= __c
.lower_bound(__k
);
871 __r
= __c
.equal_range(__k
);
873 __c
.insert(__p
, __t
);
875 void __const_constraints(const _SortedAssociativeContainer
& __c
) {
876 __kc
= __c
.key_comp();
877 __vc
= __c
.value_comp();
879 __cp
= __c
.upper_bound(__k
);
880 __cp
= __c
.lower_bound(__k
);
881 __cr
= __c
.equal_range(__k
);
883 typename
_SortedAssociativeContainer::key_compare __kc
;
884 typename
_SortedAssociativeContainer::value_compare __vc
;
885 typename
_SortedAssociativeContainer::value_type __t
;
886 typename
_SortedAssociativeContainer::key_type __k
;
887 typedef typename
_SortedAssociativeContainer::iterator _Iterator
;
888 typedef typename
_SortedAssociativeContainer::const_iterator
892 _Const_iterator __cp
;
893 std::pair
<_Iterator
,_Iterator
> __r
;
894 std::pair
<_Const_iterator
,_Const_iterator
> __cr
;
895 typename
_SortedAssociativeContainer::value_type
*__first
, *__last
;
898 // HashedAssociativeContainer
900 } // namespace __gnu_cxx
904 #endif // _GLIBCXX_BOOST_CONCEPT_CHECK