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
;
40 // ??? Should the "concept_checking*" structs begin with more than _ ?
41 #define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \
42 typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \
43 template <_func##_type_var##_concept _Tp1> \
44 struct _concept_checking##_type_var##_concept { }; \
45 typedef _concept_checking##_type_var##_concept< \
46 &_ns::_concept <_type_var>::__constraints> \
47 _concept_checking_typedef##_type_var##_concept
49 #define _GLIBCXX_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \
50 typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \
51 template <_func##_type_var1##_type_var2##_concept _Tp1> \
52 struct _concept_checking##_type_var1##_type_var2##_concept { }; \
53 typedef _concept_checking##_type_var1##_type_var2##_concept< \
54 &_ns::_concept <_type_var1,_type_var2>::__constraints> \
55 _concept_checking_typedef##_type_var1##_type_var2##_concept
57 #define _GLIBCXX_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \
58 typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \
59 template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \
60 struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \
61 typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \
62 &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints> \
63 _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept
65 #define _GLIBCXX_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \
66 typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \
67 template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \
68 struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \
69 typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \
70 &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \
71 _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept
74 template <class _Tp1
, class _Tp2
>
75 struct _Aux_require_same
{ };
78 struct _Aux_require_same
<_Tp
,_Tp
> { typedef _Tp _Type
; };
80 template <class _Tp1
, class _Tp2
>
81 struct _SameTypeConcept
83 void __constraints() {
84 typedef typename _Aux_require_same
<_Tp1
, _Tp2
>::_Type _Required
;
89 struct _IntegerConcept
{
90 void __constraints() {
91 this->__error_type_must_be_an_integer_type();
94 template <> struct _IntegerConcept
<short> { void __constraints() {} };
95 template <> struct _IntegerConcept
<unsigned short> { void __constraints(){} };
96 template <> struct _IntegerConcept
<int> { void __constraints() {} };
97 template <> struct _IntegerConcept
<unsigned int> { void __constraints() {} };
98 template <> struct _IntegerConcept
<long> { void __constraints() {} };
99 template <> struct _IntegerConcept
<unsigned long> { void __constraints() {} };
100 template <> struct _IntegerConcept
<long long> { void __constraints() {} };
101 template <> struct _IntegerConcept
<unsigned long long>
102 { void __constraints() {} };
105 struct _SignedIntegerConcept
{
106 void __constraints() {
107 this->__error_type_must_be_a_signed_integer_type();
110 template <> struct _SignedIntegerConcept
<short> { void __constraints() {} };
111 template <> struct _SignedIntegerConcept
<int> { void __constraints() {} };
112 template <> struct _SignedIntegerConcept
<long> { void __constraints() {} };
113 template <> struct _SignedIntegerConcept
<long long> { void __constraints(){}};
116 struct _UnsignedIntegerConcept
{
117 void __constraints() {
118 this->__error_type_must_be_an_unsigned_integer_type();
121 template <> struct _UnsignedIntegerConcept
<unsigned short>
122 { void __constraints() {} };
123 template <> struct _UnsignedIntegerConcept
<unsigned int>
124 { void __constraints() {} };
125 template <> struct _UnsignedIntegerConcept
<unsigned long>
126 { void __constraints() {} };
127 template <> struct _UnsignedIntegerConcept
<unsigned long long>
128 { void __constraints() {} };
130 //===========================================================================
134 struct _DefaultConstructibleConcept
136 void __constraints() {
137 _Tp __a _IsUnused
; // require default constructor
142 struct _AssignableConcept
144 void __constraints() {
145 __a
= __a
; // require assignment operator
146 __const_constraints(__a
);
148 void __const_constraints(const _Tp
& __b
) {
149 __a
= __b
; // const required for argument to assignment
152 // possibly should be "Tp* a;" and then dereference "a" in constraint
153 // functions? present way would require a default ctor, i think...
157 struct _CopyConstructibleConcept
159 void __constraints() {
160 _Tp
__a(__b
); // require copy constructor
161 _Tp
* __ptr _IsUnused
= &__a
; // require address of operator
162 __const_constraints(__a
);
164 void __const_constraints(const _Tp
& __a
) {
165 _Tp
__c(__a
) _IsUnused
; // require const copy constructor
166 const _Tp
* __ptr _IsUnused
= &__a
; // require const address of operator
171 // The SGI STL version of Assignable requires copy constructor and operator=
173 struct _SGIAssignableConcept
175 void __constraints() {
176 _Tp
__b(__a
) _IsUnused
;
177 __a
= __a
; // require assignment operator
178 __const_constraints(__a
);
180 void __const_constraints(const _Tp
& __b
) {
181 _Tp
__c(__b
) _IsUnused
;
182 __a
= __b
; // const required for argument to assignment
187 template <class _From
, class _To
>
188 struct _ConvertibleConcept
190 void __constraints() {
191 _To __y _IsUnused
= __x
;
196 // The C++ standard requirements for many concepts talk about return
197 // types that must be "convertible to bool". The problem with this
198 // requirement is that it leaves the door open for evil proxies that
199 // define things like operator|| with strange return types. Two
200 // possible solutions are:
201 // 1) require the return type to be exactly bool
202 // 2) stay with convertible to bool, and also
203 // specify stuff about all the logical operators.
204 // For now we just test for convertible to bool.
206 void __aux_require_boolean_expr(const _Tp
& __t
) {
207 bool __x _IsUnused
= __t
;
212 struct _EqualityComparableConcept
214 void __constraints() {
215 __aux_require_boolean_expr(__a
== __b
);
221 struct _LessThanComparableConcept
223 void __constraints() {
224 __aux_require_boolean_expr(__a
< __b
);
229 // This is equivalent to SGI STL's LessThanComparable.
231 struct _ComparableConcept
233 void __constraints() {
234 __aux_require_boolean_expr(__a
< __b
);
235 __aux_require_boolean_expr(__a
> __b
);
236 __aux_require_boolean_expr(__a
<= __b
);
237 __aux_require_boolean_expr(__a
>= __b
);
242 #define _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \
243 template <class _First, class _Second> \
245 void __constraints() { (void)__constraints_(); } \
246 bool __constraints_() { \
247 return __a _OP __b; \
253 #define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \
254 template <class _Ret, class _First, class _Second> \
256 void __constraints() { (void)__constraints_(); } \
257 _Ret __constraints_() { \
258 return __a _OP __b; \
264 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept
);
265 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept
);
266 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept
);
267 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept
);
268 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept
);
269 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept
);
271 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept
);
272 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept
);
273 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept
);
274 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept
);
275 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept
);
277 #undef _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT
278 #undef _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT
280 //===========================================================================
281 // Function Object Concepts
283 template <class _Func
, class _Return
>
284 struct _GeneratorConcept
286 void __constraints() {
287 const _Return
& __r _IsUnused
= __f();// require operator() member function
293 template <class _Func
>
294 struct _GeneratorConcept
<_Func
,void>
296 void __constraints() {
297 __f(); // require operator() member function
302 template <class _Func
, class _Return
, class _Arg
>
303 struct _UnaryFunctionConcept
305 void __constraints() {
306 __r
= __f(__arg
); // require operator()
313 template <class _Func
, class _Arg
>
314 struct _UnaryFunctionConcept
<_Func
, void, _Arg
> {
315 void __constraints() {
316 __f(__arg
); // require operator()
322 template <class _Func
, class _Return
, class _First
, class _Second
>
323 struct _BinaryFunctionConcept
325 void __constraints() {
326 __r
= __f(__first
, __second
); // require operator()
334 template <class _Func
, class _First
, class _Second
>
335 struct _BinaryFunctionConcept
<_Func
, void, _First
, _Second
>
337 void __constraints() {
338 __f(__first
, __second
); // require operator()
345 template <class _Func
, class _Arg
>
346 struct _UnaryPredicateConcept
348 void __constraints() {
349 __aux_require_boolean_expr(__f(__arg
)); // require op() returning bool
355 template <class _Func
, class _First
, class _Second
>
356 struct _BinaryPredicateConcept
358 void __constraints() {
359 __aux_require_boolean_expr(__f(__a
, __b
)); // require op() returning bool
366 // use this when functor is used inside a container class like std::set
367 template <class _Func
, class _First
, class _Second
>
368 struct _Const_BinaryPredicateConcept
{
369 void __constraints() {
370 __const_constraints(__f
);
372 void __const_constraints(const _Func
& __fun
) {
373 __function_requires
<_BinaryPredicateConcept
<_Func
, _First
, _Second
> >();
374 // operator() must be a const member function
375 __aux_require_boolean_expr(__fun(__a
, __b
));
382 //===========================================================================
386 struct _TrivialIteratorConcept
388 void __constraints() {
389 __function_requires
< _DefaultConstructibleConcept
<_Tp
> >();
390 __function_requires
< _AssignableConcept
<_Tp
> >();
391 __function_requires
< _EqualityComparableConcept
<_Tp
> >();
392 // typedef typename std::iterator_traits<_Tp>::value_type _V;
393 (void)*__i
; // require dereference operator
399 struct _Mutable_TrivialIteratorConcept
401 void __constraints() {
402 __function_requires
< _TrivialIteratorConcept
<_Tp
> >();
403 *__i
= *__j
; // require dereference and assignment
409 struct _InputIteratorConcept
411 void __constraints() {
412 __function_requires
< _TrivialIteratorConcept
<_Tp
> >();
413 // require iterator_traits typedef's
414 typedef typename
std::iterator_traits
<_Tp
>::difference_type _Diff
;
415 // __function_requires< _SignedIntegerConcept<_Diff> >();
416 typedef typename
std::iterator_traits
<_Tp
>::reference _Ref
;
417 typedef typename
std::iterator_traits
<_Tp
>::pointer _Pt
;
418 typedef typename
std::iterator_traits
<_Tp
>::iterator_category _Cat
;
419 __function_requires
< _ConvertibleConcept
<
420 typename
std::iterator_traits
<_Tp
>::iterator_category
,
421 std::input_iterator_tag
> >();
422 ++__i
; // require preincrement operator
423 __i
++; // require postincrement operator
428 template <class _Tp
, class _ValueT
>
429 struct _OutputIteratorConcept
431 void __constraints() {
432 __function_requires
< _AssignableConcept
<_Tp
> >();
433 ++__i
; // require preincrement operator
434 __i
++; // require postincrement operator
435 *__i
++ = __t
; // require postincrement and assignment
442 struct _ForwardIteratorConcept
444 void __constraints() {
445 __function_requires
< _InputIteratorConcept
<_Tp
> >();
446 __function_requires
< _ConvertibleConcept
<
447 typename
std::iterator_traits
<_Tp
>::iterator_category
,
448 std::forward_iterator_tag
> >();
449 typedef typename
std::iterator_traits
<_Tp
>::reference _Ref
;
450 _Ref __r _IsUnused
= *__i
;
456 struct _Mutable_ForwardIteratorConcept
458 void __constraints() {
459 __function_requires
< _ForwardIteratorConcept
<_Tp
> >();
460 *__i
++ = *__i
; // require postincrement and assignment
466 struct _BidirectionalIteratorConcept
468 void __constraints() {
469 __function_requires
< _ForwardIteratorConcept
<_Tp
> >();
470 __function_requires
< _ConvertibleConcept
<
471 typename
std::iterator_traits
<_Tp
>::iterator_category
,
472 std::bidirectional_iterator_tag
> >();
473 --__i
; // require predecrement operator
474 __i
--; // require postdecrement operator
480 struct _Mutable_BidirectionalIteratorConcept
482 void __constraints() {
483 __function_requires
< _BidirectionalIteratorConcept
<_Tp
> >();
484 __function_requires
< _Mutable_ForwardIteratorConcept
<_Tp
> >();
485 *__i
-- = *__i
; // require postdecrement and assignment
492 struct _RandomAccessIteratorConcept
494 void __constraints() {
495 __function_requires
< _BidirectionalIteratorConcept
<_Tp
> >();
496 __function_requires
< _ComparableConcept
<_Tp
> >();
497 __function_requires
< _ConvertibleConcept
<
498 typename
std::iterator_traits
<_Tp
>::iterator_category
,
499 std::random_access_iterator_tag
> >();
500 // ??? We don't use _Ref, are we just checking for "referenceability"?
501 typedef typename
std::iterator_traits
<_Tp
>::reference _Ref
;
503 __i
+= __n
; // require assignment addition operator
504 __i
= __i
+ __n
; __i
= __n
+ __i
; // require addition with difference type
505 __i
-= __n
; // require assignment subtraction op
506 __i
= __i
- __n
; // require subtraction with
508 __n
= __i
- __j
; // require difference operator
509 (void)__i
[__n
]; // require element access operator
513 typename
std::iterator_traits
<_Tp
>::difference_type __n
;
517 struct _Mutable_RandomAccessIteratorConcept
519 void __constraints() {
520 __function_requires
< _RandomAccessIteratorConcept
<_Tp
> >();
521 __function_requires
< _Mutable_BidirectionalIteratorConcept
<_Tp
> >();
522 __i
[__n
] = *__i
; // require element access and assignment
525 typename
std::iterator_traits
<_Tp
>::difference_type __n
;
528 //===========================================================================
529 // Container Concepts
531 template <class _Container
>
532 struct _ContainerConcept
534 typedef typename
_Container::value_type _Value_type
;
535 typedef typename
_Container::difference_type _Difference_type
;
536 typedef typename
_Container::size_type _Size_type
;
537 typedef typename
_Container::const_reference _Const_reference
;
538 typedef typename
_Container::const_pointer _Const_pointer
;
539 typedef typename
_Container::const_iterator _Const_iterator
;
541 void __constraints() {
542 __function_requires
< _InputIteratorConcept
<_Const_iterator
> >();
543 __function_requires
< _AssignableConcept
<_Container
> >();
544 const _Container __c
;
548 __n
= __c
.max_size();
556 template <class _Container
>
557 struct _Mutable_ContainerConcept
559 typedef typename
_Container::value_type _Value_type
;
560 typedef typename
_Container::reference _Reference
;
561 typedef typename
_Container::iterator _Iterator
;
562 typedef typename
_Container::pointer _Pointer
;
564 void __constraints() {
565 __function_requires
< _ContainerConcept
<_Container
> >();
566 __function_requires
< _AssignableConcept
<_Value_type
> >();
567 __function_requires
< _InputIteratorConcept
<_Iterator
> >();
574 _Container __c
, __c2
;
577 template <class _ForwardContainer
>
578 struct _ForwardContainerConcept
580 void __constraints() {
581 __function_requires
< _ContainerConcept
<_ForwardContainer
> >();
582 typedef typename
_ForwardContainer::const_iterator _Const_iterator
;
583 __function_requires
< _ForwardIteratorConcept
<_Const_iterator
> >();
587 template <class _ForwardContainer
>
588 struct _Mutable_ForwardContainerConcept
590 void __constraints() {
591 __function_requires
< _ForwardContainerConcept
<_ForwardContainer
> >();
592 __function_requires
< _Mutable_ContainerConcept
<_ForwardContainer
> >();
593 typedef typename
_ForwardContainer::iterator _Iterator
;
594 __function_requires
< _Mutable_ForwardIteratorConcept
<_Iterator
> >();
598 template <class _ReversibleContainer
>
599 struct _ReversibleContainerConcept
601 typedef typename
_ReversibleContainer::const_iterator _Const_iterator
;
602 typedef typename
_ReversibleContainer::const_reverse_iterator
603 _Const_reverse_iterator
;
605 void __constraints() {
606 __function_requires
< _ForwardContainerConcept
<_ReversibleContainer
> >();
607 __function_requires
< _BidirectionalIteratorConcept
<_Const_iterator
> >();
609 _BidirectionalIteratorConcept
<_Const_reverse_iterator
> >();
611 const _ReversibleContainer __c
;
612 _Const_reverse_iterator __i
= __c
.rbegin();
617 template <class _ReversibleContainer
>
618 struct _Mutable_ReversibleContainerConcept
620 typedef typename
_ReversibleContainer::iterator _Iterator
;
621 typedef typename
_ReversibleContainer::reverse_iterator _Reverse_iterator
;
623 void __constraints() {
624 __function_requires
<_ReversibleContainerConcept
<_ReversibleContainer
> >();
626 _Mutable_ForwardContainerConcept
<_ReversibleContainer
> >();
627 __function_requires
<_Mutable_BidirectionalIteratorConcept
<_Iterator
> >();
629 _Mutable_BidirectionalIteratorConcept
<_Reverse_iterator
> >();
631 _Reverse_iterator __i
= __c
.rbegin();
634 _ReversibleContainer __c
;
637 template <class _RandomAccessContainer
>
638 struct _RandomAccessContainerConcept
640 typedef typename
_RandomAccessContainer::size_type _Size_type
;
641 typedef typename
_RandomAccessContainer::const_reference _Const_reference
;
642 typedef typename
_RandomAccessContainer::const_iterator _Const_iterator
;
643 typedef typename
_RandomAccessContainer::const_reverse_iterator
644 _Const_reverse_iterator
;
646 void __constraints() {
648 _ReversibleContainerConcept
<_RandomAccessContainer
> >();
649 __function_requires
< _RandomAccessIteratorConcept
<_Const_iterator
> >();
651 _RandomAccessIteratorConcept
<_Const_reverse_iterator
> >();
653 const _RandomAccessContainer __c
;
654 _Const_reference __r _IsUnused
= __c
[__n
];
659 template <class _RandomAccessContainer
>
660 struct _Mutable_RandomAccessContainerConcept
662 typedef typename
_RandomAccessContainer::size_type _Size_type
;
663 typedef typename
_RandomAccessContainer::reference _Reference
;
664 typedef typename
_RandomAccessContainer::iterator _Iterator
;
665 typedef typename
_RandomAccessContainer::reverse_iterator _Reverse_iterator
;
667 void __constraints() {
669 _RandomAccessContainerConcept
<_RandomAccessContainer
> >();
671 _Mutable_ReversibleContainerConcept
<_RandomAccessContainer
> >();
672 __function_requires
< _Mutable_RandomAccessIteratorConcept
<_Iterator
> >();
674 _Mutable_RandomAccessIteratorConcept
<_Reverse_iterator
> >();
676 _Reference __r _IsUnused
= __c
[__i
];
679 _RandomAccessContainer __c
;
682 // A Sequence is inherently mutable
683 template <class _Sequence
>
684 struct _SequenceConcept
686 typedef typename
_Sequence::reference _Reference
;
687 typedef typename
_Sequence::const_reference _Const_reference
;
689 void __constraints() {
690 // Matt Austern's book puts DefaultConstructible here, the C++
691 // standard places it in Container
692 // function_requires< DefaultConstructible<Sequence> >();
693 __function_requires
< _Mutable_ForwardContainerConcept
<_Sequence
> >();
694 __function_requires
< _DefaultConstructibleConcept
<_Sequence
> >();
698 __c2(__n
, __t
) _IsUnused
,
699 __c3(__first
, __last
) _IsUnused
;
701 __c
.insert(__p
, __t
);
702 __c
.insert(__p
, __n
, __t
);
703 __c
.insert(__p
, __first
, __last
);
708 _Reference __r _IsUnused
= __c
.front();
710 __const_constraints(__c
);
712 void __const_constraints(const _Sequence
& __c
) {
713 _Const_reference __r _IsUnused
= __c
.front();
715 typename
_Sequence::value_type __t
;
716 typename
_Sequence::size_type __n
;
717 typename
_Sequence::value_type
*__first
, *__last
;
718 typename
_Sequence::iterator __p
, __q
;
721 template <class _FrontInsertionSequence
>
722 struct _FrontInsertionSequenceConcept
724 void __constraints() {
725 __function_requires
< _SequenceConcept
<_FrontInsertionSequence
> >();
730 _FrontInsertionSequence __c
;
731 typename
_FrontInsertionSequence::value_type __t
;
734 template <class _BackInsertionSequence
>
735 struct _BackInsertionSequenceConcept
737 typedef typename
_BackInsertionSequence::reference _Reference
;
738 typedef typename
_BackInsertionSequence::const_reference _Const_reference
;
740 void __constraints() {
741 __function_requires
< _SequenceConcept
<_BackInsertionSequence
> >();
745 _Reference __r _IsUnused
= __c
.back();
747 void __const_constraints(const _BackInsertionSequence
& __c
) {
748 _Const_reference __r _IsUnused
= __c
.back();
750 _BackInsertionSequence __c
;
751 typename
_BackInsertionSequence::value_type __t
;
754 template <class _AssociativeContainer
>
755 struct _AssociativeContainerConcept
757 void __constraints() {
758 __function_requires
< _ForwardContainerConcept
<_AssociativeContainer
> >();
760 _DefaultConstructibleConcept
<_AssociativeContainer
> >();
763 __r
= __c
.equal_range(__k
);
766 __c
.erase(__r
.first
, __r
.second
);
767 __const_constraints(__c
);
769 void __const_constraints(const _AssociativeContainer
& __c
) {
770 __ci
= __c
.find(__k
);
771 __n
= __c
.count(__k
);
772 __cr
= __c
.equal_range(__k
);
774 typedef typename
_AssociativeContainer::iterator _Iterator
;
775 typedef typename
_AssociativeContainer::const_iterator _Const_iterator
;
777 _AssociativeContainer __c
;
779 std::pair
<_Iterator
,_Iterator
> __r
;
780 _Const_iterator __ci
;
781 std::pair
<_Const_iterator
,_Const_iterator
> __cr
;
782 typename
_AssociativeContainer::key_type __k
;
783 typename
_AssociativeContainer::size_type __n
;
786 template <class _UniqueAssociativeContainer
>
787 struct _UniqueAssociativeContainerConcept
789 void __constraints() {
791 _AssociativeContainerConcept
<_UniqueAssociativeContainer
> >();
793 _UniqueAssociativeContainer
__c(__first
, __last
);
795 __pos_flag
= __c
.insert(__t
);
796 __c
.insert(__first
, __last
);
798 std::pair
<typename
_UniqueAssociativeContainer::iterator
, bool> __pos_flag
;
799 typename
_UniqueAssociativeContainer::value_type __t
;
800 typename
_UniqueAssociativeContainer::value_type
*__first
, *__last
;
803 template <class _MultipleAssociativeContainer
>
804 struct _MultipleAssociativeContainerConcept
806 void __constraints() {
808 _AssociativeContainerConcept
<_MultipleAssociativeContainer
> >();
810 _MultipleAssociativeContainer
__c(__first
, __last
);
812 __pos
= __c
.insert(__t
);
813 __c
.insert(__first
, __last
);
816 typename
_MultipleAssociativeContainer::iterator __pos _IsUnused
;
817 typename
_MultipleAssociativeContainer::value_type __t
;
818 typename
_MultipleAssociativeContainer::value_type
*__first
, *__last
;
821 template <class _SimpleAssociativeContainer
>
822 struct _SimpleAssociativeContainerConcept
824 void __constraints() {
826 _AssociativeContainerConcept
<_SimpleAssociativeContainer
> >();
827 typedef typename
_SimpleAssociativeContainer::key_type _Key_type
;
828 typedef typename
_SimpleAssociativeContainer::value_type _Value_type
;
829 typedef typename _Aux_require_same
<_Key_type
, _Value_type
>::_Type
834 template <class _SimpleAssociativeContainer
>
835 struct _PairAssociativeContainerConcept
837 void __constraints() {
839 _AssociativeContainerConcept
<_SimpleAssociativeContainer
> >();
840 typedef typename
_SimpleAssociativeContainer::key_type _Key_type
;
841 typedef typename
_SimpleAssociativeContainer::value_type _Value_type
;
842 typedef typename
_SimpleAssociativeContainer::mapped_type _Mapped_type
;
843 typedef std::pair
<const _Key_type
, _Mapped_type
> _Required_value_type
;
844 typedef typename _Aux_require_same
<_Value_type
,
845 _Required_value_type
>::_Type _Required
;
849 template <class _SortedAssociativeContainer
>
850 struct _SortedAssociativeContainerConcept
852 void __constraints() {
854 _AssociativeContainerConcept
<_SortedAssociativeContainer
> >();
856 _ReversibleContainerConcept
<_SortedAssociativeContainer
> >();
858 _SortedAssociativeContainer
860 __c2(__first
, __last
) _IsUnused
,
861 __c3(__first
, __last
, __kc
) _IsUnused
;
863 __p
= __c
.upper_bound(__k
);
864 __p
= __c
.lower_bound(__k
);
865 __r
= __c
.equal_range(__k
);
867 __c
.insert(__p
, __t
);
869 void __const_constraints(const _SortedAssociativeContainer
& __c
) {
870 __kc
= __c
.key_comp();
871 __vc
= __c
.value_comp();
873 __cp
= __c
.upper_bound(__k
);
874 __cp
= __c
.lower_bound(__k
);
875 __cr
= __c
.equal_range(__k
);
877 typename
_SortedAssociativeContainer::key_compare __kc
;
878 typename
_SortedAssociativeContainer::value_compare __vc
;
879 typename
_SortedAssociativeContainer::value_type __t
;
880 typename
_SortedAssociativeContainer::key_type __k
;
881 typedef typename
_SortedAssociativeContainer::iterator _Iterator
;
882 typedef typename
_SortedAssociativeContainer::const_iterator
886 _Const_iterator __cp
;
887 std::pair
<_Iterator
,_Iterator
> __r
;
888 std::pair
<_Const_iterator
,_Const_iterator
> __cr
;
889 typename
_SortedAssociativeContainer::value_type
*__first
, *__last
;
892 // HashedAssociativeContainer
894 } // namespace __gnu_cxx
898 #endif // _GLIBCXX_BOOST_CONCEPT_CHECK