1*404b540aSrobert // -*- C++ -*-
2*404b540aSrobert
3*404b540aSrobert // Copyright (C) 2004, 2005 Free Software Foundation, Inc.
4*404b540aSrobert //
5*404b540aSrobert // This file is part of the GNU ISO C++ Library. This library is free
6*404b540aSrobert // software; you can redistribute it and/or modify it under the
7*404b540aSrobert // terms of the GNU General Public License as published by the
8*404b540aSrobert // Free Software Foundation; either version 2, or (at your option)
9*404b540aSrobert // any later version.
10*404b540aSrobert
11*404b540aSrobert // This library is distributed in the hope that it will be useful,
12*404b540aSrobert // but WITHOUT ANY WARRANTY; without even the implied warranty of
13*404b540aSrobert // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14*404b540aSrobert // GNU General Public License for more details.
15*404b540aSrobert
16*404b540aSrobert // You should have received a copy of the GNU General Public License along
17*404b540aSrobert // with this library; see the file COPYING. If not, write to the Free
18*404b540aSrobert // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19*404b540aSrobert // USA.
20*404b540aSrobert
21*404b540aSrobert // As a special exception, you may use this file as part of a free software
22*404b540aSrobert // library without restriction. Specifically, if other files instantiate
23*404b540aSrobert // templates or use macros or inline functions from this file, or you compile
24*404b540aSrobert // this file and link it with other files to produce an executable, this
25*404b540aSrobert // file does not by itself cause the resulting executable to be covered by
26*404b540aSrobert // the GNU General Public License. This exception does not however
27*404b540aSrobert // invalidate any other reasons why the executable file might be covered by
28*404b540aSrobert // the GNU General Public License.
29*404b540aSrobert
30*404b540aSrobert // (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
31*404b540aSrobert // sell and distribute this software is granted provided this
32*404b540aSrobert // copyright notice appears in all copies. This software is provided
33*404b540aSrobert // "as is" without express or implied warranty, and with no claim as
34*404b540aSrobert // to its suitability for any purpose.
35*404b540aSrobert //
36*404b540aSrobert
37*404b540aSrobert /** @file boost_concept_check.h
38*404b540aSrobert * This is an internal header file, included by other library headers.
39*404b540aSrobert * You should not attempt to use it directly.
40*404b540aSrobert */
41*404b540aSrobert
42*404b540aSrobert // GCC Note: based on version 1.12.0 of the Boost library.
43*404b540aSrobert
44*404b540aSrobert #ifndef _BOOST_CONCEPT_CHECK_H
45*404b540aSrobert #define _BOOST_CONCEPT_CHECK_H 1
46*404b540aSrobert
47*404b540aSrobert #pragma GCC system_header
48*404b540aSrobert
49*404b540aSrobert #include <cstddef> // for ptrdiff_t, used next
50*404b540aSrobert #include <bits/stl_iterator_base_types.h> // for traits and tags
51*404b540aSrobert #include <utility> // for pair<>
52*404b540aSrobert
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)53*404b540aSrobert _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
54*404b540aSrobert
55*404b540aSrobert #define _IsUnused __attribute__ ((__unused__))
56*404b540aSrobert
57*404b540aSrobert // When the C-C code is in use, we would like this function to do as little
58*404b540aSrobert // as possible at runtime, use as few resources as possible, and hopefully
59*404b540aSrobert // be elided out of existence... hmmm.
60*404b540aSrobert template <class _Concept>
61*404b540aSrobert inline void __function_requires()
62*404b540aSrobert {
63*404b540aSrobert void (_Concept::*__x)() _IsUnused = &_Concept::__constraints;
64*404b540aSrobert }
65*404b540aSrobert
66*404b540aSrobert // No definition: if this is referenced, there's a problem with
67*404b540aSrobert // the instantiating type not being one of the required integer types.
68*404b540aSrobert // Unfortunately, this results in a link-time error, not a compile-time error.
69*404b540aSrobert void __error_type_must_be_an_integer_type();
70*404b540aSrobert void __error_type_must_be_an_unsigned_integer_type();
71*404b540aSrobert void __error_type_must_be_a_signed_integer_type();
72*404b540aSrobert
73*404b540aSrobert // ??? Should the "concept_checking*" structs begin with more than _ ?
74*404b540aSrobert #define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \
75*404b540aSrobert typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \
76*404b540aSrobert template <_func##_type_var##_concept _Tp1> \
77*404b540aSrobert struct _concept_checking##_type_var##_concept { }; \
78*404b540aSrobert typedef _concept_checking##_type_var##_concept< \
79*404b540aSrobert &_ns::_concept <_type_var>::__constraints> \
80*404b540aSrobert _concept_checking_typedef##_type_var##_concept
81*404b540aSrobert
82*404b540aSrobert #define _GLIBCXX_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \
83*404b540aSrobert typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \
84*404b540aSrobert template <_func##_type_var1##_type_var2##_concept _Tp1> \
85*404b540aSrobert struct _concept_checking##_type_var1##_type_var2##_concept { }; \
86*404b540aSrobert typedef _concept_checking##_type_var1##_type_var2##_concept< \
87*404b540aSrobert &_ns::_concept <_type_var1,_type_var2>::__constraints> \
88*404b540aSrobert _concept_checking_typedef##_type_var1##_type_var2##_concept
89*404b540aSrobert
90*404b540aSrobert #define _GLIBCXX_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \
91*404b540aSrobert typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \
92*404b540aSrobert template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \
93*404b540aSrobert struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \
94*404b540aSrobert typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \
95*404b540aSrobert &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints> \
96*404b540aSrobert _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept
97*404b540aSrobert
98*404b540aSrobert #define _GLIBCXX_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \
99*404b540aSrobert typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \
100*404b540aSrobert template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \
101*404b540aSrobert struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \
102*404b540aSrobert typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \
103*404b540aSrobert &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \
104*404b540aSrobert _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept
105*404b540aSrobert
106*404b540aSrobert
107*404b540aSrobert template <class _Tp1, class _Tp2>
108*404b540aSrobert struct _Aux_require_same { };
109*404b540aSrobert
110*404b540aSrobert template <class _Tp>
111*404b540aSrobert struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
112*404b540aSrobert
113*404b540aSrobert template <class _Tp1, class _Tp2>
114*404b540aSrobert struct _SameTypeConcept
115*404b540aSrobert {
116*404b540aSrobert void __constraints() {
117*404b540aSrobert typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required;
118*404b540aSrobert }
119*404b540aSrobert };
120*404b540aSrobert
121*404b540aSrobert template <class _Tp>
122*404b540aSrobert struct _IntegerConcept {
123*404b540aSrobert void __constraints() {
124*404b540aSrobert __error_type_must_be_an_integer_type();
125*404b540aSrobert }
126*404b540aSrobert };
127*404b540aSrobert template <> struct _IntegerConcept<short> { void __constraints() {} };
128*404b540aSrobert template <> struct _IntegerConcept<unsigned short> { void __constraints(){} };
129*404b540aSrobert template <> struct _IntegerConcept<int> { void __constraints() {} };
130*404b540aSrobert template <> struct _IntegerConcept<unsigned int> { void __constraints() {} };
131*404b540aSrobert template <> struct _IntegerConcept<long> { void __constraints() {} };
132*404b540aSrobert template <> struct _IntegerConcept<unsigned long> { void __constraints() {} };
133*404b540aSrobert template <> struct _IntegerConcept<long long> { void __constraints() {} };
134*404b540aSrobert template <> struct _IntegerConcept<unsigned long long>
135*404b540aSrobert { void __constraints() {} };
136*404b540aSrobert
137*404b540aSrobert template <class _Tp>
138*404b540aSrobert struct _SignedIntegerConcept {
139*404b540aSrobert void __constraints() {
140*404b540aSrobert __error_type_must_be_a_signed_integer_type();
141*404b540aSrobert }
142*404b540aSrobert };
143*404b540aSrobert template <> struct _SignedIntegerConcept<short> { void __constraints() {} };
144*404b540aSrobert template <> struct _SignedIntegerConcept<int> { void __constraints() {} };
145*404b540aSrobert template <> struct _SignedIntegerConcept<long> { void __constraints() {} };
146*404b540aSrobert template <> struct _SignedIntegerConcept<long long> { void __constraints(){}};
147*404b540aSrobert
148*404b540aSrobert template <class _Tp>
149*404b540aSrobert struct _UnsignedIntegerConcept {
150*404b540aSrobert void __constraints() {
151*404b540aSrobert __error_type_must_be_an_unsigned_integer_type();
152*404b540aSrobert }
153*404b540aSrobert };
154*404b540aSrobert template <> struct _UnsignedIntegerConcept<unsigned short>
155*404b540aSrobert { void __constraints() {} };
156*404b540aSrobert template <> struct _UnsignedIntegerConcept<unsigned int>
157*404b540aSrobert { void __constraints() {} };
158*404b540aSrobert template <> struct _UnsignedIntegerConcept<unsigned long>
159*404b540aSrobert { void __constraints() {} };
160*404b540aSrobert template <> struct _UnsignedIntegerConcept<unsigned long long>
161*404b540aSrobert { void __constraints() {} };
162*404b540aSrobert
163*404b540aSrobert //===========================================================================
164*404b540aSrobert // Basic Concepts
165*404b540aSrobert
166*404b540aSrobert template <class _Tp>
167*404b540aSrobert struct _DefaultConstructibleConcept
168*404b540aSrobert {
169*404b540aSrobert void __constraints() {
170*404b540aSrobert _Tp __a _IsUnused; // require default constructor
171*404b540aSrobert }
172*404b540aSrobert };
173*404b540aSrobert
174*404b540aSrobert template <class _Tp>
175*404b540aSrobert struct _AssignableConcept
176*404b540aSrobert {
177*404b540aSrobert void __constraints() {
178*404b540aSrobert __a = __a; // require assignment operator
179*404b540aSrobert __const_constraints(__a);
180*404b540aSrobert }
181*404b540aSrobert void __const_constraints(const _Tp& __b) {
182*404b540aSrobert __a = __b; // const required for argument to assignment
183*404b540aSrobert }
184*404b540aSrobert _Tp __a;
185*404b540aSrobert // possibly should be "Tp* a;" and then dereference "a" in constraint
186*404b540aSrobert // functions? present way would require a default ctor, i think...
187*404b540aSrobert };
188*404b540aSrobert
189*404b540aSrobert template <class _Tp>
190*404b540aSrobert struct _CopyConstructibleConcept
191*404b540aSrobert {
192*404b540aSrobert void __constraints() {
193*404b540aSrobert _Tp __a(__b); // require copy constructor
194*404b540aSrobert _Tp* __ptr _IsUnused = &__a; // require address of operator
195*404b540aSrobert __const_constraints(__a);
196*404b540aSrobert }
197*404b540aSrobert void __const_constraints(const _Tp& __a) {
198*404b540aSrobert _Tp __c _IsUnused(__a); // require const copy constructor
199*404b540aSrobert const _Tp* __ptr _IsUnused = &__a; // require const address of operator
200*404b540aSrobert }
201*404b540aSrobert _Tp __b;
202*404b540aSrobert };
203*404b540aSrobert
204*404b540aSrobert // The SGI STL version of Assignable requires copy constructor and operator=
205*404b540aSrobert template <class _Tp>
206*404b540aSrobert struct _SGIAssignableConcept
207*404b540aSrobert {
208*404b540aSrobert void __constraints() {
209*404b540aSrobert _Tp __b _IsUnused(__a);
210*404b540aSrobert __a = __a; // require assignment operator
211*404b540aSrobert __const_constraints(__a);
212*404b540aSrobert }
213*404b540aSrobert void __const_constraints(const _Tp& __b) {
214*404b540aSrobert _Tp __c _IsUnused(__b);
215*404b540aSrobert __a = __b; // const required for argument to assignment
216*404b540aSrobert }
217*404b540aSrobert _Tp __a;
218*404b540aSrobert };
219*404b540aSrobert
220*404b540aSrobert template <class _From, class _To>
221*404b540aSrobert struct _ConvertibleConcept
222*404b540aSrobert {
223*404b540aSrobert void __constraints() {
224*404b540aSrobert _To __y _IsUnused = __x;
225*404b540aSrobert }
226*404b540aSrobert _From __x;
227*404b540aSrobert };
228*404b540aSrobert
229*404b540aSrobert // The C++ standard requirements for many concepts talk about return
230*404b540aSrobert // types that must be "convertible to bool". The problem with this
231*404b540aSrobert // requirement is that it leaves the door open for evil proxies that
232*404b540aSrobert // define things like operator|| with strange return types. Two
233*404b540aSrobert // possible solutions are:
234*404b540aSrobert // 1) require the return type to be exactly bool
235*404b540aSrobert // 2) stay with convertible to bool, and also
236*404b540aSrobert // specify stuff about all the logical operators.
237*404b540aSrobert // For now we just test for convertible to bool.
238*404b540aSrobert template <class _Tp>
239*404b540aSrobert void __aux_require_boolean_expr(const _Tp& __t) {
240*404b540aSrobert bool __x _IsUnused = __t;
241*404b540aSrobert }
242*404b540aSrobert
243*404b540aSrobert // FIXME
244*404b540aSrobert template <class _Tp>
245*404b540aSrobert struct _EqualityComparableConcept
246*404b540aSrobert {
247*404b540aSrobert void __constraints() {
248*404b540aSrobert __aux_require_boolean_expr(__a == __b);
249*404b540aSrobert }
250*404b540aSrobert _Tp __a, __b;
251*404b540aSrobert };
252*404b540aSrobert
253*404b540aSrobert template <class _Tp>
254*404b540aSrobert struct _LessThanComparableConcept
255*404b540aSrobert {
256*404b540aSrobert void __constraints() {
257*404b540aSrobert __aux_require_boolean_expr(__a < __b);
258*404b540aSrobert }
259*404b540aSrobert _Tp __a, __b;
260*404b540aSrobert };
261*404b540aSrobert
262*404b540aSrobert // This is equivalent to SGI STL's LessThanComparable.
263*404b540aSrobert template <class _Tp>
264*404b540aSrobert struct _ComparableConcept
265*404b540aSrobert {
266*404b540aSrobert void __constraints() {
267*404b540aSrobert __aux_require_boolean_expr(__a < __b);
268*404b540aSrobert __aux_require_boolean_expr(__a > __b);
269*404b540aSrobert __aux_require_boolean_expr(__a <= __b);
270*404b540aSrobert __aux_require_boolean_expr(__a >= __b);
271*404b540aSrobert }
272*404b540aSrobert _Tp __a, __b;
273*404b540aSrobert };
274*404b540aSrobert
275*404b540aSrobert #define _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \
276*404b540aSrobert template <class _First, class _Second> \
277*404b540aSrobert struct _NAME { \
278*404b540aSrobert void __constraints() { (void)__constraints_(); } \
279*404b540aSrobert bool __constraints_() { \
280*404b540aSrobert return __a _OP __b; \
281*404b540aSrobert } \
282*404b540aSrobert _First __a; \
283*404b540aSrobert _Second __b; \
284*404b540aSrobert }
285*404b540aSrobert
286*404b540aSrobert #define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \
287*404b540aSrobert template <class _Ret, class _First, class _Second> \
288*404b540aSrobert struct _NAME { \
289*404b540aSrobert void __constraints() { (void)__constraints_(); } \
290*404b540aSrobert _Ret __constraints_() { \
291*404b540aSrobert return __a _OP __b; \
292*404b540aSrobert } \
293*404b540aSrobert _First __a; \
294*404b540aSrobert _Second __b; \
295*404b540aSrobert }
296*404b540aSrobert
297*404b540aSrobert _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept);
298*404b540aSrobert _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept);
299*404b540aSrobert _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept);
300*404b540aSrobert _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept);
301*404b540aSrobert _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept);
302*404b540aSrobert _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept);
303*404b540aSrobert
304*404b540aSrobert _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept);
305*404b540aSrobert _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept);
306*404b540aSrobert _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept);
307*404b540aSrobert _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept);
308*404b540aSrobert _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept);
309*404b540aSrobert
310*404b540aSrobert #undef _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT
311*404b540aSrobert #undef _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT
312*404b540aSrobert
313*404b540aSrobert //===========================================================================
314*404b540aSrobert // Function Object Concepts
315*404b540aSrobert
316*404b540aSrobert template <class _Func, class _Return>
317*404b540aSrobert struct _GeneratorConcept
318*404b540aSrobert {
319*404b540aSrobert void __constraints() {
320*404b540aSrobert const _Return& __r _IsUnused = __f();// require operator() member function
321*404b540aSrobert }
322*404b540aSrobert _Func __f;
323*404b540aSrobert };
324*404b540aSrobert
325*404b540aSrobert
326*404b540aSrobert template <class _Func>
327*404b540aSrobert struct _GeneratorConcept<_Func,void>
328*404b540aSrobert {
329*404b540aSrobert void __constraints() {
330*404b540aSrobert __f(); // require operator() member function
331*404b540aSrobert }
332*404b540aSrobert _Func __f;
333*404b540aSrobert };
334*404b540aSrobert
335*404b540aSrobert template <class _Func, class _Return, class _Arg>
336*404b540aSrobert struct _UnaryFunctionConcept
337*404b540aSrobert {
338*404b540aSrobert void __constraints() {
339*404b540aSrobert __r = __f(__arg); // require operator()
340*404b540aSrobert }
341*404b540aSrobert _Func __f;
342*404b540aSrobert _Arg __arg;
343*404b540aSrobert _Return __r;
344*404b540aSrobert };
345*404b540aSrobert
346*404b540aSrobert template <class _Func, class _Arg>
347*404b540aSrobert struct _UnaryFunctionConcept<_Func, void, _Arg> {
348*404b540aSrobert void __constraints() {
349*404b540aSrobert __f(__arg); // require operator()
350*404b540aSrobert }
351*404b540aSrobert _Func __f;
352*404b540aSrobert _Arg __arg;
353*404b540aSrobert };
354*404b540aSrobert
355*404b540aSrobert template <class _Func, class _Return, class _First, class _Second>
356*404b540aSrobert struct _BinaryFunctionConcept
357*404b540aSrobert {
358*404b540aSrobert void __constraints() {
359*404b540aSrobert __r = __f(__first, __second); // require operator()
360*404b540aSrobert }
361*404b540aSrobert _Func __f;
362*404b540aSrobert _First __first;
363*404b540aSrobert _Second __second;
364*404b540aSrobert _Return __r;
365*404b540aSrobert };
366*404b540aSrobert
367*404b540aSrobert template <class _Func, class _First, class _Second>
368*404b540aSrobert struct _BinaryFunctionConcept<_Func, void, _First, _Second>
369*404b540aSrobert {
370*404b540aSrobert void __constraints() {
371*404b540aSrobert __f(__first, __second); // require operator()
372*404b540aSrobert }
373*404b540aSrobert _Func __f;
374*404b540aSrobert _First __first;
375*404b540aSrobert _Second __second;
376*404b540aSrobert };
377*404b540aSrobert
378*404b540aSrobert template <class _Func, class _Arg>
379*404b540aSrobert struct _UnaryPredicateConcept
380*404b540aSrobert {
381*404b540aSrobert void __constraints() {
382*404b540aSrobert __aux_require_boolean_expr(__f(__arg)); // require op() returning bool
383*404b540aSrobert }
384*404b540aSrobert _Func __f;
385*404b540aSrobert _Arg __arg;
386*404b540aSrobert };
387*404b540aSrobert
388*404b540aSrobert template <class _Func, class _First, class _Second>
389*404b540aSrobert struct _BinaryPredicateConcept
390*404b540aSrobert {
391*404b540aSrobert void __constraints() {
392*404b540aSrobert __aux_require_boolean_expr(__f(__a, __b)); // require op() returning bool
393*404b540aSrobert }
394*404b540aSrobert _Func __f;
395*404b540aSrobert _First __a;
396*404b540aSrobert _Second __b;
397*404b540aSrobert };
398*404b540aSrobert
399*404b540aSrobert // use this when functor is used inside a container class like std::set
400*404b540aSrobert template <class _Func, class _First, class _Second>
401*404b540aSrobert struct _Const_BinaryPredicateConcept {
402*404b540aSrobert void __constraints() {
403*404b540aSrobert __const_constraints(__f);
404*404b540aSrobert }
405*404b540aSrobert void __const_constraints(const _Func& __fun) {
406*404b540aSrobert __function_requires<_BinaryPredicateConcept<_Func, _First, _Second> >();
407*404b540aSrobert // operator() must be a const member function
408*404b540aSrobert __aux_require_boolean_expr(__fun(__a, __b));
409*404b540aSrobert }
410*404b540aSrobert _Func __f;
411*404b540aSrobert _First __a;
412*404b540aSrobert _Second __b;
413*404b540aSrobert };
414*404b540aSrobert
415*404b540aSrobert //===========================================================================
416*404b540aSrobert // Iterator Concepts
417*404b540aSrobert
418*404b540aSrobert template <class _Tp>
419*404b540aSrobert struct _TrivialIteratorConcept
420*404b540aSrobert {
421*404b540aSrobert void __constraints() {
422*404b540aSrobert // __function_requires< _DefaultConstructibleConcept<_Tp> >();
423*404b540aSrobert __function_requires< _AssignableConcept<_Tp> >();
424*404b540aSrobert __function_requires< _EqualityComparableConcept<_Tp> >();
425*404b540aSrobert // typedef typename std::iterator_traits<_Tp>::value_type _V;
426*404b540aSrobert (void)*__i; // require dereference operator
427*404b540aSrobert }
428*404b540aSrobert _Tp __i;
429*404b540aSrobert };
430*404b540aSrobert
431*404b540aSrobert template <class _Tp>
432*404b540aSrobert struct _Mutable_TrivialIteratorConcept
433*404b540aSrobert {
434*404b540aSrobert void __constraints() {
435*404b540aSrobert __function_requires< _TrivialIteratorConcept<_Tp> >();
436*404b540aSrobert *__i = *__j; // require dereference and assignment
437*404b540aSrobert }
438*404b540aSrobert _Tp __i, __j;
439*404b540aSrobert };
440*404b540aSrobert
441*404b540aSrobert template <class _Tp>
442*404b540aSrobert struct _InputIteratorConcept
443*404b540aSrobert {
444*404b540aSrobert void __constraints() {
445*404b540aSrobert __function_requires< _TrivialIteratorConcept<_Tp> >();
446*404b540aSrobert // require iterator_traits typedef's
447*404b540aSrobert typedef typename std::iterator_traits<_Tp>::difference_type _Diff;
448*404b540aSrobert // __function_requires< _SignedIntegerConcept<_Diff> >();
449*404b540aSrobert typedef typename std::iterator_traits<_Tp>::reference _Ref;
450*404b540aSrobert typedef typename std::iterator_traits<_Tp>::pointer _Pt;
451*404b540aSrobert typedef typename std::iterator_traits<_Tp>::iterator_category _Cat;
452*404b540aSrobert __function_requires< _ConvertibleConcept<
453*404b540aSrobert typename std::iterator_traits<_Tp>::iterator_category,
454*404b540aSrobert std::input_iterator_tag> >();
455*404b540aSrobert ++__i; // require preincrement operator
456*404b540aSrobert __i++; // require postincrement operator
457*404b540aSrobert }
458*404b540aSrobert _Tp __i;
459*404b540aSrobert };
460*404b540aSrobert
461*404b540aSrobert template <class _Tp, class _ValueT>
462*404b540aSrobert struct _OutputIteratorConcept
463*404b540aSrobert {
464*404b540aSrobert void __constraints() {
465*404b540aSrobert __function_requires< _AssignableConcept<_Tp> >();
466*404b540aSrobert ++__i; // require preincrement operator
467*404b540aSrobert __i++; // require postincrement operator
468*404b540aSrobert *__i++ = __t; // require postincrement and assignment
469*404b540aSrobert }
470*404b540aSrobert _Tp __i;
471*404b540aSrobert _ValueT __t;
472*404b540aSrobert };
473*404b540aSrobert
474*404b540aSrobert template <class _Tp>
475*404b540aSrobert struct _ForwardIteratorConcept
476*404b540aSrobert {
477*404b540aSrobert void __constraints() {
478*404b540aSrobert __function_requires< _InputIteratorConcept<_Tp> >();
479*404b540aSrobert __function_requires< _DefaultConstructibleConcept<_Tp> >();
480*404b540aSrobert __function_requires< _ConvertibleConcept<
481*404b540aSrobert typename std::iterator_traits<_Tp>::iterator_category,
482*404b540aSrobert std::forward_iterator_tag> >();
483*404b540aSrobert typedef typename std::iterator_traits<_Tp>::reference _Ref;
484*404b540aSrobert _Ref __r _IsUnused = *__i;
485*404b540aSrobert }
486*404b540aSrobert _Tp __i;
487*404b540aSrobert };
488*404b540aSrobert
489*404b540aSrobert template <class _Tp>
490*404b540aSrobert struct _Mutable_ForwardIteratorConcept
491*404b540aSrobert {
492*404b540aSrobert void __constraints() {
493*404b540aSrobert __function_requires< _ForwardIteratorConcept<_Tp> >();
494*404b540aSrobert *__i++ = *__i; // require postincrement and assignment
495*404b540aSrobert }
496*404b540aSrobert _Tp __i;
497*404b540aSrobert };
498*404b540aSrobert
499*404b540aSrobert template <class _Tp>
500*404b540aSrobert struct _BidirectionalIteratorConcept
501*404b540aSrobert {
502*404b540aSrobert void __constraints() {
503*404b540aSrobert __function_requires< _ForwardIteratorConcept<_Tp> >();
504*404b540aSrobert __function_requires< _ConvertibleConcept<
505*404b540aSrobert typename std::iterator_traits<_Tp>::iterator_category,
506*404b540aSrobert std::bidirectional_iterator_tag> >();
507*404b540aSrobert --__i; // require predecrement operator
508*404b540aSrobert __i--; // require postdecrement operator
509*404b540aSrobert }
510*404b540aSrobert _Tp __i;
511*404b540aSrobert };
512*404b540aSrobert
513*404b540aSrobert template <class _Tp>
514*404b540aSrobert struct _Mutable_BidirectionalIteratorConcept
515*404b540aSrobert {
516*404b540aSrobert void __constraints() {
517*404b540aSrobert __function_requires< _BidirectionalIteratorConcept<_Tp> >();
518*404b540aSrobert __function_requires< _Mutable_ForwardIteratorConcept<_Tp> >();
519*404b540aSrobert *__i-- = *__i; // require postdecrement and assignment
520*404b540aSrobert }
521*404b540aSrobert _Tp __i;
522*404b540aSrobert };
523*404b540aSrobert
524*404b540aSrobert
525*404b540aSrobert template <class _Tp>
526*404b540aSrobert struct _RandomAccessIteratorConcept
527*404b540aSrobert {
528*404b540aSrobert void __constraints() {
529*404b540aSrobert __function_requires< _BidirectionalIteratorConcept<_Tp> >();
530*404b540aSrobert __function_requires< _ComparableConcept<_Tp> >();
531*404b540aSrobert __function_requires< _ConvertibleConcept<
532*404b540aSrobert typename std::iterator_traits<_Tp>::iterator_category,
533*404b540aSrobert std::random_access_iterator_tag> >();
534*404b540aSrobert // ??? We don't use _Ref, are we just checking for "referenceability"?
535*404b540aSrobert typedef typename std::iterator_traits<_Tp>::reference _Ref;
536*404b540aSrobert
537*404b540aSrobert __i += __n; // require assignment addition operator
538*404b540aSrobert __i = __i + __n; __i = __n + __i; // require addition with difference type
539*404b540aSrobert __i -= __n; // require assignment subtraction op
540*404b540aSrobert __i = __i - __n; // require subtraction with
541*404b540aSrobert // difference type
542*404b540aSrobert __n = __i - __j; // require difference operator
543*404b540aSrobert (void)__i[__n]; // require element access operator
544*404b540aSrobert }
545*404b540aSrobert _Tp __a, __b;
546*404b540aSrobert _Tp __i, __j;
547*404b540aSrobert typename std::iterator_traits<_Tp>::difference_type __n;
548*404b540aSrobert };
549*404b540aSrobert
550*404b540aSrobert template <class _Tp>
551*404b540aSrobert struct _Mutable_RandomAccessIteratorConcept
552*404b540aSrobert {
553*404b540aSrobert void __constraints() {
554*404b540aSrobert __function_requires< _RandomAccessIteratorConcept<_Tp> >();
555*404b540aSrobert __function_requires< _Mutable_BidirectionalIteratorConcept<_Tp> >();
556*404b540aSrobert __i[__n] = *__i; // require element access and assignment
557*404b540aSrobert }
558*404b540aSrobert _Tp __i;
559*404b540aSrobert typename std::iterator_traits<_Tp>::difference_type __n;
560*404b540aSrobert };
561*404b540aSrobert
562*404b540aSrobert //===========================================================================
563*404b540aSrobert // Container Concepts
564*404b540aSrobert
565*404b540aSrobert template <class _Container>
566*404b540aSrobert struct _ContainerConcept
567*404b540aSrobert {
568*404b540aSrobert typedef typename _Container::value_type _Value_type;
569*404b540aSrobert typedef typename _Container::difference_type _Difference_type;
570*404b540aSrobert typedef typename _Container::size_type _Size_type;
571*404b540aSrobert typedef typename _Container::const_reference _Const_reference;
572*404b540aSrobert typedef typename _Container::const_pointer _Const_pointer;
573*404b540aSrobert typedef typename _Container::const_iterator _Const_iterator;
574*404b540aSrobert
575*404b540aSrobert void __constraints() {
576*404b540aSrobert __function_requires< _InputIteratorConcept<_Const_iterator> >();
577*404b540aSrobert __function_requires< _AssignableConcept<_Container> >();
578*404b540aSrobert const _Container __c;
579*404b540aSrobert __i = __c.begin();
580*404b540aSrobert __i = __c.end();
581*404b540aSrobert __n = __c.size();
582*404b540aSrobert __n = __c.max_size();
583*404b540aSrobert __b = __c.empty();
584*404b540aSrobert }
585*404b540aSrobert bool __b;
586*404b540aSrobert _Const_iterator __i;
587*404b540aSrobert _Size_type __n;
588*404b540aSrobert };
589*404b540aSrobert
590*404b540aSrobert template <class _Container>
591*404b540aSrobert struct _Mutable_ContainerConcept
592*404b540aSrobert {
593*404b540aSrobert typedef typename _Container::value_type _Value_type;
594*404b540aSrobert typedef typename _Container::reference _Reference;
595*404b540aSrobert typedef typename _Container::iterator _Iterator;
596*404b540aSrobert typedef typename _Container::pointer _Pointer;
597*404b540aSrobert
598*404b540aSrobert void __constraints() {
599*404b540aSrobert __function_requires< _ContainerConcept<_Container> >();
600*404b540aSrobert __function_requires< _AssignableConcept<_Value_type> >();
601*404b540aSrobert __function_requires< _InputIteratorConcept<_Iterator> >();
602*404b540aSrobert
603*404b540aSrobert __i = __c.begin();
604*404b540aSrobert __i = __c.end();
605*404b540aSrobert __c.swap(__c2);
606*404b540aSrobert }
607*404b540aSrobert _Iterator __i;
608*404b540aSrobert _Container __c, __c2;
609*404b540aSrobert };
610*404b540aSrobert
611*404b540aSrobert template <class _ForwardContainer>
612*404b540aSrobert struct _ForwardContainerConcept
613*404b540aSrobert {
614*404b540aSrobert void __constraints() {
615*404b540aSrobert __function_requires< _ContainerConcept<_ForwardContainer> >();
616*404b540aSrobert typedef typename _ForwardContainer::const_iterator _Const_iterator;
617*404b540aSrobert __function_requires< _ForwardIteratorConcept<_Const_iterator> >();
618*404b540aSrobert }
619*404b540aSrobert };
620*404b540aSrobert
621*404b540aSrobert template <class _ForwardContainer>
622*404b540aSrobert struct _Mutable_ForwardContainerConcept
623*404b540aSrobert {
624*404b540aSrobert void __constraints() {
625*404b540aSrobert __function_requires< _ForwardContainerConcept<_ForwardContainer> >();
626*404b540aSrobert __function_requires< _Mutable_ContainerConcept<_ForwardContainer> >();
627*404b540aSrobert typedef typename _ForwardContainer::iterator _Iterator;
628*404b540aSrobert __function_requires< _Mutable_ForwardIteratorConcept<_Iterator> >();
629*404b540aSrobert }
630*404b540aSrobert };
631*404b540aSrobert
632*404b540aSrobert template <class _ReversibleContainer>
633*404b540aSrobert struct _ReversibleContainerConcept
634*404b540aSrobert {
635*404b540aSrobert typedef typename _ReversibleContainer::const_iterator _Const_iterator;
636*404b540aSrobert typedef typename _ReversibleContainer::const_reverse_iterator
637*404b540aSrobert _Const_reverse_iterator;
638*404b540aSrobert
639*404b540aSrobert void __constraints() {
640*404b540aSrobert __function_requires< _ForwardContainerConcept<_ReversibleContainer> >();
641*404b540aSrobert __function_requires< _BidirectionalIteratorConcept<_Const_iterator> >();
642*404b540aSrobert __function_requires<
643*404b540aSrobert _BidirectionalIteratorConcept<_Const_reverse_iterator> >();
644*404b540aSrobert
645*404b540aSrobert const _ReversibleContainer __c;
646*404b540aSrobert _Const_reverse_iterator __i = __c.rbegin();
647*404b540aSrobert __i = __c.rend();
648*404b540aSrobert }
649*404b540aSrobert };
650*404b540aSrobert
651*404b540aSrobert template <class _ReversibleContainer>
652*404b540aSrobert struct _Mutable_ReversibleContainerConcept
653*404b540aSrobert {
654*404b540aSrobert typedef typename _ReversibleContainer::iterator _Iterator;
655*404b540aSrobert typedef typename _ReversibleContainer::reverse_iterator _Reverse_iterator;
656*404b540aSrobert
657*404b540aSrobert void __constraints() {
658*404b540aSrobert __function_requires<_ReversibleContainerConcept<_ReversibleContainer> >();
659*404b540aSrobert __function_requires<
660*404b540aSrobert _Mutable_ForwardContainerConcept<_ReversibleContainer> >();
661*404b540aSrobert __function_requires<_Mutable_BidirectionalIteratorConcept<_Iterator> >();
662*404b540aSrobert __function_requires<
663*404b540aSrobert _Mutable_BidirectionalIteratorConcept<_Reverse_iterator> >();
664*404b540aSrobert
665*404b540aSrobert _Reverse_iterator __i = __c.rbegin();
666*404b540aSrobert __i = __c.rend();
667*404b540aSrobert }
668*404b540aSrobert _ReversibleContainer __c;
669*404b540aSrobert };
670*404b540aSrobert
671*404b540aSrobert template <class _RandomAccessContainer>
672*404b540aSrobert struct _RandomAccessContainerConcept
673*404b540aSrobert {
674*404b540aSrobert typedef typename _RandomAccessContainer::size_type _Size_type;
675*404b540aSrobert typedef typename _RandomAccessContainer::const_reference _Const_reference;
676*404b540aSrobert typedef typename _RandomAccessContainer::const_iterator _Const_iterator;
677*404b540aSrobert typedef typename _RandomAccessContainer::const_reverse_iterator
678*404b540aSrobert _Const_reverse_iterator;
679*404b540aSrobert
680*404b540aSrobert void __constraints() {
681*404b540aSrobert __function_requires<
682*404b540aSrobert _ReversibleContainerConcept<_RandomAccessContainer> >();
683*404b540aSrobert __function_requires< _RandomAccessIteratorConcept<_Const_iterator> >();
684*404b540aSrobert __function_requires<
685*404b540aSrobert _RandomAccessIteratorConcept<_Const_reverse_iterator> >();
686*404b540aSrobert
687*404b540aSrobert const _RandomAccessContainer __c;
688*404b540aSrobert _Const_reference __r _IsUnused = __c[__n];
689*404b540aSrobert }
690*404b540aSrobert _Size_type __n;
691*404b540aSrobert };
692*404b540aSrobert
693*404b540aSrobert template <class _RandomAccessContainer>
694*404b540aSrobert struct _Mutable_RandomAccessContainerConcept
695*404b540aSrobert {
696*404b540aSrobert typedef typename _RandomAccessContainer::size_type _Size_type;
697*404b540aSrobert typedef typename _RandomAccessContainer::reference _Reference;
698*404b540aSrobert typedef typename _RandomAccessContainer::iterator _Iterator;
699*404b540aSrobert typedef typename _RandomAccessContainer::reverse_iterator _Reverse_iterator;
700*404b540aSrobert
701*404b540aSrobert void __constraints() {
702*404b540aSrobert __function_requires<
703*404b540aSrobert _RandomAccessContainerConcept<_RandomAccessContainer> >();
704*404b540aSrobert __function_requires<
705*404b540aSrobert _Mutable_ReversibleContainerConcept<_RandomAccessContainer> >();
706*404b540aSrobert __function_requires< _Mutable_RandomAccessIteratorConcept<_Iterator> >();
707*404b540aSrobert __function_requires<
708*404b540aSrobert _Mutable_RandomAccessIteratorConcept<_Reverse_iterator> >();
709*404b540aSrobert
710*404b540aSrobert _Reference __r _IsUnused = __c[__i];
711*404b540aSrobert }
712*404b540aSrobert _Size_type __i;
713*404b540aSrobert _RandomAccessContainer __c;
714*404b540aSrobert };
715*404b540aSrobert
716*404b540aSrobert // A Sequence is inherently mutable
717*404b540aSrobert template <class _Sequence>
718*404b540aSrobert struct _SequenceConcept
719*404b540aSrobert {
720*404b540aSrobert typedef typename _Sequence::reference _Reference;
721*404b540aSrobert typedef typename _Sequence::const_reference _Const_reference;
722*404b540aSrobert
723*404b540aSrobert void __constraints() {
724*404b540aSrobert // Matt Austern's book puts DefaultConstructible here, the C++
725*404b540aSrobert // standard places it in Container
726*404b540aSrobert // function_requires< DefaultConstructible<Sequence> >();
727*404b540aSrobert __function_requires< _Mutable_ForwardContainerConcept<_Sequence> >();
728*404b540aSrobert __function_requires< _DefaultConstructibleConcept<_Sequence> >();
729*404b540aSrobert
730*404b540aSrobert _Sequence
731*404b540aSrobert __c _IsUnused(__n, __t),
732*404b540aSrobert __c2 _IsUnused(__first, __last);
733*404b540aSrobert
734*404b540aSrobert __c.insert(__p, __t);
735*404b540aSrobert __c.insert(__p, __n, __t);
736*404b540aSrobert __c.insert(__p, __first, __last);
737*404b540aSrobert
738*404b540aSrobert __c.erase(__p);
739*404b540aSrobert __c.erase(__p, __q);
740*404b540aSrobert
741*404b540aSrobert _Reference __r _IsUnused = __c.front();
742*404b540aSrobert
743*404b540aSrobert __const_constraints(__c);
744*404b540aSrobert }
745*404b540aSrobert void __const_constraints(const _Sequence& __c) {
746*404b540aSrobert _Const_reference __r _IsUnused = __c.front();
747*404b540aSrobert }
748*404b540aSrobert typename _Sequence::value_type __t;
749*404b540aSrobert typename _Sequence::size_type __n;
750*404b540aSrobert typename _Sequence::value_type *__first, *__last;
751*404b540aSrobert typename _Sequence::iterator __p, __q;
752*404b540aSrobert };
753*404b540aSrobert
754*404b540aSrobert template <class _FrontInsertionSequence>
755*404b540aSrobert struct _FrontInsertionSequenceConcept
756*404b540aSrobert {
757*404b540aSrobert void __constraints() {
758*404b540aSrobert __function_requires< _SequenceConcept<_FrontInsertionSequence> >();
759*404b540aSrobert
760*404b540aSrobert __c.push_front(__t);
761*404b540aSrobert __c.pop_front();
762*404b540aSrobert }
763*404b540aSrobert _FrontInsertionSequence __c;
764*404b540aSrobert typename _FrontInsertionSequence::value_type __t;
765*404b540aSrobert };
766*404b540aSrobert
767*404b540aSrobert template <class _BackInsertionSequence>
768*404b540aSrobert struct _BackInsertionSequenceConcept
769*404b540aSrobert {
770*404b540aSrobert typedef typename _BackInsertionSequence::reference _Reference;
771*404b540aSrobert typedef typename _BackInsertionSequence::const_reference _Const_reference;
772*404b540aSrobert
773*404b540aSrobert void __constraints() {
774*404b540aSrobert __function_requires< _SequenceConcept<_BackInsertionSequence> >();
775*404b540aSrobert
776*404b540aSrobert __c.push_back(__t);
777*404b540aSrobert __c.pop_back();
778*404b540aSrobert _Reference __r _IsUnused = __c.back();
779*404b540aSrobert }
780*404b540aSrobert void __const_constraints(const _BackInsertionSequence& __c) {
781*404b540aSrobert _Const_reference __r _IsUnused = __c.back();
782*404b540aSrobert };
783*404b540aSrobert _BackInsertionSequence __c;
784*404b540aSrobert typename _BackInsertionSequence::value_type __t;
785*404b540aSrobert };
786*404b540aSrobert
787*404b540aSrobert template <class _AssociativeContainer>
788*404b540aSrobert struct _AssociativeContainerConcept
789*404b540aSrobert {
790*404b540aSrobert void __constraints() {
791*404b540aSrobert __function_requires< _ForwardContainerConcept<_AssociativeContainer> >();
792*404b540aSrobert __function_requires<
793*404b540aSrobert _DefaultConstructibleConcept<_AssociativeContainer> >();
794*404b540aSrobert
795*404b540aSrobert __i = __c.find(__k);
796*404b540aSrobert __r = __c.equal_range(__k);
797*404b540aSrobert __c.erase(__k);
798*404b540aSrobert __c.erase(__i);
799*404b540aSrobert __c.erase(__r.first, __r.second);
800*404b540aSrobert __const_constraints(__c);
801*404b540aSrobert }
802*404b540aSrobert void __const_constraints(const _AssociativeContainer& __c) {
803*404b540aSrobert __ci = __c.find(__k);
804*404b540aSrobert __n = __c.count(__k);
805*404b540aSrobert __cr = __c.equal_range(__k);
806*404b540aSrobert }
807*404b540aSrobert typedef typename _AssociativeContainer::iterator _Iterator;
808*404b540aSrobert typedef typename _AssociativeContainer::const_iterator _Const_iterator;
809*404b540aSrobert
810*404b540aSrobert _AssociativeContainer __c;
811*404b540aSrobert _Iterator __i;
812*404b540aSrobert std::pair<_Iterator,_Iterator> __r;
813*404b540aSrobert _Const_iterator __ci;
814*404b540aSrobert std::pair<_Const_iterator,_Const_iterator> __cr;
815*404b540aSrobert typename _AssociativeContainer::key_type __k;
816*404b540aSrobert typename _AssociativeContainer::size_type __n;
817*404b540aSrobert };
818*404b540aSrobert
819*404b540aSrobert template <class _UniqueAssociativeContainer>
820*404b540aSrobert struct _UniqueAssociativeContainerConcept
821*404b540aSrobert {
822*404b540aSrobert void __constraints() {
823*404b540aSrobert __function_requires<
824*404b540aSrobert _AssociativeContainerConcept<_UniqueAssociativeContainer> >();
825*404b540aSrobert
826*404b540aSrobert _UniqueAssociativeContainer __c(__first, __last);
827*404b540aSrobert
828*404b540aSrobert __pos_flag = __c.insert(__t);
829*404b540aSrobert __c.insert(__first, __last);
830*404b540aSrobert }
831*404b540aSrobert std::pair<typename _UniqueAssociativeContainer::iterator, bool> __pos_flag;
832*404b540aSrobert typename _UniqueAssociativeContainer::value_type __t;
833*404b540aSrobert typename _UniqueAssociativeContainer::value_type *__first, *__last;
834*404b540aSrobert };
835*404b540aSrobert
836*404b540aSrobert template <class _MultipleAssociativeContainer>
837*404b540aSrobert struct _MultipleAssociativeContainerConcept
838*404b540aSrobert {
839*404b540aSrobert void __constraints() {
840*404b540aSrobert __function_requires<
841*404b540aSrobert _AssociativeContainerConcept<_MultipleAssociativeContainer> >();
842*404b540aSrobert
843*404b540aSrobert _MultipleAssociativeContainer __c(__first, __last);
844*404b540aSrobert
845*404b540aSrobert __pos = __c.insert(__t);
846*404b540aSrobert __c.insert(__first, __last);
847*404b540aSrobert
848*404b540aSrobert }
849*404b540aSrobert typename _MultipleAssociativeContainer::iterator __pos;
850*404b540aSrobert typename _MultipleAssociativeContainer::value_type __t;
851*404b540aSrobert typename _MultipleAssociativeContainer::value_type *__first, *__last;
852*404b540aSrobert };
853*404b540aSrobert
854*404b540aSrobert template <class _SimpleAssociativeContainer>
855*404b540aSrobert struct _SimpleAssociativeContainerConcept
856*404b540aSrobert {
857*404b540aSrobert void __constraints() {
858*404b540aSrobert __function_requires<
859*404b540aSrobert _AssociativeContainerConcept<_SimpleAssociativeContainer> >();
860*404b540aSrobert typedef typename _SimpleAssociativeContainer::key_type _Key_type;
861*404b540aSrobert typedef typename _SimpleAssociativeContainer::value_type _Value_type;
862*404b540aSrobert typedef typename _Aux_require_same<_Key_type, _Value_type>::_Type
863*404b540aSrobert _Required;
864*404b540aSrobert }
865*404b540aSrobert };
866*404b540aSrobert
867*404b540aSrobert template <class _SimpleAssociativeContainer>
868*404b540aSrobert struct _PairAssociativeContainerConcept
869*404b540aSrobert {
870*404b540aSrobert void __constraints() {
871*404b540aSrobert __function_requires<
872*404b540aSrobert _AssociativeContainerConcept<_SimpleAssociativeContainer> >();
873*404b540aSrobert typedef typename _SimpleAssociativeContainer::key_type _Key_type;
874*404b540aSrobert typedef typename _SimpleAssociativeContainer::value_type _Value_type;
875*404b540aSrobert typedef typename _SimpleAssociativeContainer::mapped_type _Mapped_type;
876*404b540aSrobert typedef std::pair<const _Key_type, _Mapped_type> _Required_value_type;
877*404b540aSrobert typedef typename _Aux_require_same<_Value_type,
878*404b540aSrobert _Required_value_type>::_Type _Required;
879*404b540aSrobert }
880*404b540aSrobert };
881*404b540aSrobert
882*404b540aSrobert template <class _SortedAssociativeContainer>
883*404b540aSrobert struct _SortedAssociativeContainerConcept
884*404b540aSrobert {
885*404b540aSrobert void __constraints() {
886*404b540aSrobert __function_requires<
887*404b540aSrobert _AssociativeContainerConcept<_SortedAssociativeContainer> >();
888*404b540aSrobert __function_requires<
889*404b540aSrobert _ReversibleContainerConcept<_SortedAssociativeContainer> >();
890*404b540aSrobert
891*404b540aSrobert _SortedAssociativeContainer
892*404b540aSrobert __c _IsUnused(__kc),
893*404b540aSrobert __c2 _IsUnused(__first, __last),
894*404b540aSrobert __c3 _IsUnused(__first, __last, __kc);
895*404b540aSrobert
896*404b540aSrobert __p = __c.upper_bound(__k);
897*404b540aSrobert __p = __c.lower_bound(__k);
898*404b540aSrobert __r = __c.equal_range(__k);
899*404b540aSrobert
900*404b540aSrobert __c.insert(__p, __t);
901*404b540aSrobert }
902*404b540aSrobert void __const_constraints(const _SortedAssociativeContainer& __c) {
903*404b540aSrobert __kc = __c.key_comp();
904*404b540aSrobert __vc = __c.value_comp();
905*404b540aSrobert
906*404b540aSrobert __cp = __c.upper_bound(__k);
907*404b540aSrobert __cp = __c.lower_bound(__k);
908*404b540aSrobert __cr = __c.equal_range(__k);
909*404b540aSrobert }
910*404b540aSrobert typename _SortedAssociativeContainer::key_compare __kc;
911*404b540aSrobert typename _SortedAssociativeContainer::value_compare __vc;
912*404b540aSrobert typename _SortedAssociativeContainer::value_type __t;
913*404b540aSrobert typename _SortedAssociativeContainer::key_type __k;
914*404b540aSrobert typedef typename _SortedAssociativeContainer::iterator _Iterator;
915*404b540aSrobert typedef typename _SortedAssociativeContainer::const_iterator
916*404b540aSrobert _Const_iterator;
917*404b540aSrobert
918*404b540aSrobert _Iterator __p;
919*404b540aSrobert _Const_iterator __cp;
920*404b540aSrobert std::pair<_Iterator,_Iterator> __r;
921*404b540aSrobert std::pair<_Const_iterator,_Const_iterator> __cr;
922*404b540aSrobert typename _SortedAssociativeContainer::value_type *__first, *__last;
923*404b540aSrobert };
924*404b540aSrobert
925*404b540aSrobert // HashedAssociativeContainer
926*404b540aSrobert
927*404b540aSrobert _GLIBCXX_END_NAMESPACE
928*404b540aSrobert
929*404b540aSrobert #undef _IsUnused
930*404b540aSrobert
931*404b540aSrobert #endif // _GLIBCXX_BOOST_CONCEPT_CHECK
932*404b540aSrobert
933*404b540aSrobert
934