1*19731d4fSespie // Copyright (C) 2004 Free Software Foundation, Inc.
203a78d15Sespie //
3*19731d4fSespie // This file is part of the GNU ISO C++ Library.  This library is free
4*19731d4fSespie // software; you can redistribute it and/or modify it under the
5*19731d4fSespie // terms of the GNU General Public License as published by the
6*19731d4fSespie // Free Software Foundation; either version 2, or (at your option)
7*19731d4fSespie // any later version.
8*19731d4fSespie 
9*19731d4fSespie // This library is distributed in the hope that it will be useful,
10*19731d4fSespie // but WITHOUT ANY WARRANTY; without even the implied warranty of
11*19731d4fSespie // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*19731d4fSespie // GNU General Public License for more details.
13*19731d4fSespie 
14*19731d4fSespie // You should have received a copy of the GNU General Public License along
15*19731d4fSespie // with this library; see the file COPYING.  If not, write to the Free
16*19731d4fSespie // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17*19731d4fSespie // USA.
18*19731d4fSespie 
19*19731d4fSespie // As a special exception, you may use this file as part of a free software
20*19731d4fSespie // library without restriction.  Specifically, if other files instantiate
21*19731d4fSespie // templates or use macros or inline functions from this file, or you compile
22*19731d4fSespie // this file and link it with other files to produce an executable, this
23*19731d4fSespie // file does not by itself cause the resulting executable to be covered by
24*19731d4fSespie // the GNU General Public License.  This exception does not however
25*19731d4fSespie // invalidate any other reasons why the executable file might be covered by
26*19731d4fSespie // the GNU General Public License.
27*19731d4fSespie 
2803a78d15Sespie // (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
2903a78d15Sespie // sell and distribute this software is granted provided this
3003a78d15Sespie // copyright notice appears in all copies. This software is provided
3103a78d15Sespie // "as is" without express or implied warranty, and with no claim as
3203a78d15Sespie // to its suitability for any purpose.
3303a78d15Sespie //
3403a78d15Sespie 
3503a78d15Sespie // GCC Note:  based on version 1.12.0 of the Boost library.
3603a78d15Sespie 
3703a78d15Sespie /** @file boost_concept_check.h
3803a78d15Sespie  *  This is an internal header file, included by other library headers.
3903a78d15Sespie  *  You should not attempt to use it directly.
4003a78d15Sespie  */
4103a78d15Sespie 
4203a78d15Sespie #ifndef _GLIBCPP_BOOST_CONCEPT_CHECK
4303a78d15Sespie #define _GLIBCPP_BOOST_CONCEPT_CHECK 1
4403a78d15Sespie 
4503a78d15Sespie #pragma GCC system_header
4603a78d15Sespie #include <cstddef>                // for ptrdiff_t, used next
4703a78d15Sespie #include <bits/stl_iterator_base_types.h>    // for traits and tags
4803a78d15Sespie #include <utility>                           // for pair<>
4903a78d15Sespie 
5003a78d15Sespie 
5103a78d15Sespie namespace __gnu_cxx
5203a78d15Sespie {
5303a78d15Sespie 
5403a78d15Sespie #define _IsUnused __attribute__ ((__unused__))
5503a78d15Sespie 
5603a78d15Sespie // When the C-C code is in use, we would like this function to do as little
5703a78d15Sespie // as possible at runtime, use as few resources as possible, and hopefully
5803a78d15Sespie // be elided out of existence... hmmm.
5903a78d15Sespie template <class _Concept>
__function_requires()6003a78d15Sespie inline void __function_requires()
6103a78d15Sespie {
6203a78d15Sespie   void (_Concept::*__x)() _IsUnused = &_Concept::__constraints;
6303a78d15Sespie }
6403a78d15Sespie 
6503a78d15Sespie 
6603a78d15Sespie // ??? Should the "concept_checking*" structs begin with more than _ ?
6703a78d15Sespie #define _GLIBCPP_CLASS_REQUIRES(_type_var, _ns, _concept) \
6803a78d15Sespie   typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \
6903a78d15Sespie   template <_func##_type_var##_concept _Tp1> \
7003a78d15Sespie   struct _concept_checking##_type_var##_concept { }; \
7103a78d15Sespie   typedef _concept_checking##_type_var##_concept< \
7203a78d15Sespie     &_ns::_concept <_type_var>::__constraints> \
7303a78d15Sespie     _concept_checking_typedef##_type_var##_concept
7403a78d15Sespie 
7503a78d15Sespie #define _GLIBCPP_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \
7603a78d15Sespie   typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \
7703a78d15Sespie   template <_func##_type_var1##_type_var2##_concept _Tp1> \
7803a78d15Sespie   struct _concept_checking##_type_var1##_type_var2##_concept { }; \
7903a78d15Sespie   typedef _concept_checking##_type_var1##_type_var2##_concept< \
8003a78d15Sespie     &_ns::_concept <_type_var1,_type_var2>::__constraints> \
8103a78d15Sespie     _concept_checking_typedef##_type_var1##_type_var2##_concept
8203a78d15Sespie 
8303a78d15Sespie #define _GLIBCPP_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \
8403a78d15Sespie   typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \
8503a78d15Sespie   template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \
8603a78d15Sespie   struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \
8703a78d15Sespie   typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \
8803a78d15Sespie     &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints>  \
8903a78d15Sespie   _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept
9003a78d15Sespie 
9103a78d15Sespie #define _GLIBCPP_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \
9203a78d15Sespie   typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \
9303a78d15Sespie   template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \
9403a78d15Sespie   struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \
9503a78d15Sespie   typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \
9603a78d15Sespie   &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \
9703a78d15Sespie     _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept
9803a78d15Sespie 
9903a78d15Sespie 
10003a78d15Sespie template <class _Tp1, class _Tp2>
10103a78d15Sespie struct _Aux_require_same { };
10203a78d15Sespie 
10303a78d15Sespie template <class _Tp>
10403a78d15Sespie struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
10503a78d15Sespie 
10603a78d15Sespie   template <class _Tp1, class _Tp2>
10703a78d15Sespie   struct _SameTypeConcept
10803a78d15Sespie   {
10903a78d15Sespie     void __constraints() {
11003a78d15Sespie       typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required;
11103a78d15Sespie     }
11203a78d15Sespie   };
11303a78d15Sespie 
11403a78d15Sespie   template <class _Tp>
11503a78d15Sespie   struct _IntegerConcept {
11603a78d15Sespie     void __constraints() {
11703a78d15Sespie       __error_type_must_be_an_integer_type();
11803a78d15Sespie     }
11903a78d15Sespie   };
12003a78d15Sespie   template <> struct _IntegerConcept<short> { void __constraints() {} };
12103a78d15Sespie   template <> struct _IntegerConcept<unsigned short> { void __constraints(){} };
12203a78d15Sespie   template <> struct _IntegerConcept<int> { void __constraints() {} };
12303a78d15Sespie   template <> struct _IntegerConcept<unsigned int> { void __constraints() {} };
12403a78d15Sespie   template <> struct _IntegerConcept<long> { void __constraints() {} };
12503a78d15Sespie   template <> struct _IntegerConcept<unsigned long> { void __constraints() {} };
12603a78d15Sespie   template <> struct _IntegerConcept<long long> { void __constraints() {} };
12703a78d15Sespie   template <> struct _IntegerConcept<unsigned long long>
12803a78d15Sespie                                                 { void __constraints() {} };
12903a78d15Sespie 
13003a78d15Sespie   template <class _Tp>
13103a78d15Sespie   struct _SignedIntegerConcept {
13203a78d15Sespie     void __constraints() {
13303a78d15Sespie       __error_type_must_be_a_signed_integer_type();
13403a78d15Sespie     }
13503a78d15Sespie   };
13603a78d15Sespie   template <> struct _SignedIntegerConcept<short> { void __constraints() {} };
13703a78d15Sespie   template <> struct _SignedIntegerConcept<int> { void __constraints() {} };
13803a78d15Sespie   template <> struct _SignedIntegerConcept<long> { void __constraints() {} };
13903a78d15Sespie   template <> struct _SignedIntegerConcept<long long> { void __constraints(){}};
14003a78d15Sespie 
14103a78d15Sespie   template <class _Tp>
14203a78d15Sespie   struct _UnsignedIntegerConcept {
14303a78d15Sespie     void __constraints() {
14403a78d15Sespie       __error_type_must_be_an_unsigned_integer_type();
14503a78d15Sespie     }
14603a78d15Sespie   };
14703a78d15Sespie   template <> struct _UnsignedIntegerConcept<unsigned short>
14803a78d15Sespie     { void __constraints() {} };
14903a78d15Sespie   template <> struct _UnsignedIntegerConcept<unsigned int>
15003a78d15Sespie     { void __constraints() {} };
15103a78d15Sespie   template <> struct _UnsignedIntegerConcept<unsigned long>
15203a78d15Sespie     { void __constraints() {} };
15303a78d15Sespie   template <> struct _UnsignedIntegerConcept<unsigned long long>
15403a78d15Sespie     { void __constraints() {} };
15503a78d15Sespie 
15603a78d15Sespie   //===========================================================================
15703a78d15Sespie   // Basic Concepts
15803a78d15Sespie 
15903a78d15Sespie   template <class _Tp>
16003a78d15Sespie   struct _DefaultConstructibleConcept
16103a78d15Sespie   {
16203a78d15Sespie     void __constraints() {
16303a78d15Sespie       _Tp __a _IsUnused;                // require default constructor
16403a78d15Sespie     }
16503a78d15Sespie   };
16603a78d15Sespie 
16703a78d15Sespie   template <class _Tp>
16803a78d15Sespie   struct _AssignableConcept
16903a78d15Sespie   {
17003a78d15Sespie     void __constraints() {
17103a78d15Sespie       __a = __a;                        // require assignment operator
17203a78d15Sespie       __const_constraints(__a);
17303a78d15Sespie     }
17403a78d15Sespie     void __const_constraints(const _Tp& __b) {
17503a78d15Sespie       __a = __b;                   // const required for argument to assignment
17603a78d15Sespie     }
17703a78d15Sespie     _Tp __a;
17803a78d15Sespie     // possibly should be "Tp* a;" and then dereference "a" in constraint
17903a78d15Sespie     // functions?  present way would require a default ctor, i think...
18003a78d15Sespie   };
18103a78d15Sespie 
18203a78d15Sespie   template <class _Tp>
18303a78d15Sespie   struct _CopyConstructibleConcept
18403a78d15Sespie   {
18503a78d15Sespie     void __constraints() {
18603a78d15Sespie       _Tp __a(__b);                     // require copy constructor
18703a78d15Sespie       _Tp* __ptr _IsUnused = &__a;      // require address of operator
18803a78d15Sespie       __const_constraints(__a);
18903a78d15Sespie     }
19003a78d15Sespie     void __const_constraints(const _Tp& __a) {
19103a78d15Sespie       _Tp __c(__a) _IsUnused;           // require const copy constructor
19203a78d15Sespie       const _Tp* __ptr _IsUnused = &__a; // require const address of operator
19303a78d15Sespie     }
19403a78d15Sespie     _Tp __b;
19503a78d15Sespie   };
19603a78d15Sespie 
19703a78d15Sespie   // The SGI STL version of Assignable requires copy constructor and operator=
19803a78d15Sespie   template <class _Tp>
19903a78d15Sespie   struct _SGIAssignableConcept
20003a78d15Sespie   {
20103a78d15Sespie     void __constraints() {
20203a78d15Sespie       _Tp __b(__a) _IsUnused;
20303a78d15Sespie       __a = __a;                        // require assignment operator
20403a78d15Sespie       __const_constraints(__a);
20503a78d15Sespie     }
20603a78d15Sespie     void __const_constraints(const _Tp& __b) {
20703a78d15Sespie       _Tp __c(__b) _IsUnused;
20803a78d15Sespie       __a = __b;              // const required for argument to assignment
20903a78d15Sespie     }
21003a78d15Sespie     _Tp __a;
21103a78d15Sespie   };
21203a78d15Sespie 
21303a78d15Sespie   template <class _From, class _To>
21403a78d15Sespie   struct _ConvertibleConcept
21503a78d15Sespie   {
21603a78d15Sespie     void __constraints() {
21703a78d15Sespie       _To __y _IsUnused = __x;
21803a78d15Sespie     }
21903a78d15Sespie     _From __x;
22003a78d15Sespie   };
22103a78d15Sespie 
22203a78d15Sespie   // The C++ standard requirements for many concepts talk about return
22303a78d15Sespie   // types that must be "convertible to bool".  The problem with this
22403a78d15Sespie   // requirement is that it leaves the door open for evil proxies that
22503a78d15Sespie   // define things like operator|| with strange return types.  Two
22603a78d15Sespie   // possible solutions are:
22703a78d15Sespie   // 1) require the return type to be exactly bool
22803a78d15Sespie   // 2) stay with convertible to bool, and also
22903a78d15Sespie   //    specify stuff about all the logical operators.
23003a78d15Sespie   // For now we just test for convertible to bool.
23103a78d15Sespie   template <class _Tp>
23203a78d15Sespie   void __aux_require_boolean_expr(const _Tp& __t) {
23303a78d15Sespie     bool __x _IsUnused = __t;
23403a78d15Sespie   }
23503a78d15Sespie 
23603a78d15Sespie // FIXME
23703a78d15Sespie   template <class _Tp>
23803a78d15Sespie   struct _EqualityComparableConcept
23903a78d15Sespie   {
24003a78d15Sespie     void __constraints() {
24103a78d15Sespie       __aux_require_boolean_expr(__a == __b);
24203a78d15Sespie       __aux_require_boolean_expr(__a != __b);
24303a78d15Sespie     }
24403a78d15Sespie     _Tp __a, __b;
24503a78d15Sespie   };
24603a78d15Sespie 
24703a78d15Sespie   template <class _Tp>
24803a78d15Sespie   struct _LessThanComparableConcept
24903a78d15Sespie   {
25003a78d15Sespie     void __constraints() {
25103a78d15Sespie       __aux_require_boolean_expr(__a < __b);
25203a78d15Sespie     }
25303a78d15Sespie     _Tp __a, __b;
25403a78d15Sespie   };
25503a78d15Sespie 
25603a78d15Sespie   // This is equivalent to SGI STL's LessThanComparable.
25703a78d15Sespie   template <class _Tp>
25803a78d15Sespie   struct _ComparableConcept
25903a78d15Sespie   {
26003a78d15Sespie     void __constraints() {
26103a78d15Sespie       __aux_require_boolean_expr(__a < __b);
26203a78d15Sespie       __aux_require_boolean_expr(__a > __b);
26303a78d15Sespie       __aux_require_boolean_expr(__a <= __b);
26403a78d15Sespie       __aux_require_boolean_expr(__a >= __b);
26503a78d15Sespie     }
26603a78d15Sespie     _Tp __a, __b;
26703a78d15Sespie   };
26803a78d15Sespie 
26903a78d15Sespie #define _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \
27003a78d15Sespie   template <class _First, class _Second> \
27103a78d15Sespie   struct _NAME { \
27203a78d15Sespie     void __constraints() { (void)__constraints_(); } \
27303a78d15Sespie     bool __constraints_() {  \
27403a78d15Sespie       return  __a _OP __b; \
27503a78d15Sespie     } \
27603a78d15Sespie     _First __a; \
27703a78d15Sespie     _Second __b; \
27803a78d15Sespie   }
27903a78d15Sespie 
28003a78d15Sespie #define _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \
28103a78d15Sespie   template <class _Ret, class _First, class _Second> \
28203a78d15Sespie   struct _NAME { \
28303a78d15Sespie     void __constraints() { (void)__constraints_(); } \
28403a78d15Sespie     _Ret __constraints_() {  \
28503a78d15Sespie       return __a _OP __b; \
28603a78d15Sespie     } \
28703a78d15Sespie     _First __a; \
28803a78d15Sespie     _Second __b; \
28903a78d15Sespie   }
29003a78d15Sespie 
29103a78d15Sespie   _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept);
29203a78d15Sespie   _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept);
29303a78d15Sespie   _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept);
29403a78d15Sespie   _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept);
29503a78d15Sespie   _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept);
29603a78d15Sespie   _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept);
29703a78d15Sespie 
29803a78d15Sespie   _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept);
29903a78d15Sespie   _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept);
30003a78d15Sespie   _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept);
30103a78d15Sespie   _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept);
30203a78d15Sespie   _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept);
30303a78d15Sespie 
30403a78d15Sespie #undef _GLIBCPP_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT
30503a78d15Sespie #undef _GLIBCPP_DEFINE_BINARY_OPERATOR_CONSTRAINT
30603a78d15Sespie 
30703a78d15Sespie   //===========================================================================
30803a78d15Sespie   // Function Object Concepts
30903a78d15Sespie 
31003a78d15Sespie   template <class _Func, class _Return>
31103a78d15Sespie   struct _GeneratorConcept
31203a78d15Sespie   {
31303a78d15Sespie     void __constraints() {
31403a78d15Sespie       const _Return& __r _IsUnused = __f();// require operator() member function
31503a78d15Sespie     }
31603a78d15Sespie     _Func __f;
31703a78d15Sespie   };
31803a78d15Sespie 
31903a78d15Sespie 
32003a78d15Sespie   template <class _Func>
32103a78d15Sespie   struct _GeneratorConcept<_Func,void>
32203a78d15Sespie   {
32303a78d15Sespie     void __constraints() {
32403a78d15Sespie       __f();                            // require operator() member function
32503a78d15Sespie     }
32603a78d15Sespie     _Func __f;
32703a78d15Sespie   };
32803a78d15Sespie 
32903a78d15Sespie   template <class _Func, class _Return, class _Arg>
33003a78d15Sespie   struct _UnaryFunctionConcept
33103a78d15Sespie   {
33203a78d15Sespie     void __constraints() {
33303a78d15Sespie       __r = __f(__arg);                  // require operator()
33403a78d15Sespie     }
33503a78d15Sespie     _Func __f;
33603a78d15Sespie     _Arg __arg;
33703a78d15Sespie     _Return __r;
33803a78d15Sespie   };
33903a78d15Sespie 
34003a78d15Sespie   template <class _Func, class _Arg>
34103a78d15Sespie   struct _UnaryFunctionConcept<_Func, void, _Arg> {
34203a78d15Sespie     void __constraints() {
34303a78d15Sespie       __f(__arg);                       // require operator()
34403a78d15Sespie     }
34503a78d15Sespie     _Func __f;
34603a78d15Sespie     _Arg __arg;
34703a78d15Sespie   };
34803a78d15Sespie 
34903a78d15Sespie   template <class _Func, class _Return, class _First, class _Second>
35003a78d15Sespie   struct _BinaryFunctionConcept
35103a78d15Sespie   {
35203a78d15Sespie     void __constraints() {
35303a78d15Sespie       __r = __f(__first, __second);     // require operator()
35403a78d15Sespie     }
35503a78d15Sespie     _Func __f;
35603a78d15Sespie     _First __first;
35703a78d15Sespie     _Second __second;
35803a78d15Sespie     _Return __r;
35903a78d15Sespie   };
36003a78d15Sespie 
36103a78d15Sespie   template <class _Func, class _First, class _Second>
36203a78d15Sespie   struct _BinaryFunctionConcept<_Func, void, _First, _Second>
36303a78d15Sespie   {
36403a78d15Sespie     void __constraints() {
36503a78d15Sespie       __f(__first, __second);           // require operator()
36603a78d15Sespie     }
36703a78d15Sespie     _Func __f;
36803a78d15Sespie     _First __first;
36903a78d15Sespie     _Second __second;
37003a78d15Sespie   };
37103a78d15Sespie 
37203a78d15Sespie   template <class _Func, class _Arg>
37303a78d15Sespie   struct _UnaryPredicateConcept
37403a78d15Sespie   {
37503a78d15Sespie     void __constraints() {
37603a78d15Sespie       __aux_require_boolean_expr(__f(__arg)); // require op() returning bool
37703a78d15Sespie     }
37803a78d15Sespie     _Func __f;
37903a78d15Sespie     _Arg __arg;
38003a78d15Sespie   };
38103a78d15Sespie 
38203a78d15Sespie   template <class _Func, class _First, class _Second>
38303a78d15Sespie   struct _BinaryPredicateConcept
38403a78d15Sespie   {
38503a78d15Sespie     void __constraints() {
38603a78d15Sespie       __aux_require_boolean_expr(__f(__a, __b)); // require op() returning bool
38703a78d15Sespie     }
38803a78d15Sespie     _Func __f;
38903a78d15Sespie     _First __a;
39003a78d15Sespie     _Second __b;
39103a78d15Sespie   };
39203a78d15Sespie 
39303a78d15Sespie   // use this when functor is used inside a container class like std::set
39403a78d15Sespie   template <class _Func, class _First, class _Second>
39503a78d15Sespie   struct _Const_BinaryPredicateConcept {
39603a78d15Sespie     void __constraints() {
39703a78d15Sespie       __const_constraints(__f);
39803a78d15Sespie     }
39903a78d15Sespie     void __const_constraints(const _Func& __fun) {
40003a78d15Sespie       __function_requires<_BinaryPredicateConcept<_Func, _First, _Second> >();
40103a78d15Sespie       // operator() must be a const member function
40203a78d15Sespie       __aux_require_boolean_expr(__fun(__a, __b));
40303a78d15Sespie     }
40403a78d15Sespie     _Func __f;
40503a78d15Sespie     _First __a;
40603a78d15Sespie     _Second __b;
40703a78d15Sespie   };
40803a78d15Sespie 
40903a78d15Sespie   //===========================================================================
41003a78d15Sespie   // Iterator Concepts
41103a78d15Sespie 
41203a78d15Sespie   template <class _Tp>
41303a78d15Sespie   struct _TrivialIteratorConcept
41403a78d15Sespie   {
41503a78d15Sespie     void __constraints() {
41603a78d15Sespie       __function_requires< _DefaultConstructibleConcept<_Tp> >();
41703a78d15Sespie       __function_requires< _AssignableConcept<_Tp> >();
41803a78d15Sespie       __function_requires< _EqualityComparableConcept<_Tp> >();
41903a78d15Sespie //      typedef typename std::iterator_traits<_Tp>::value_type _V;
42003a78d15Sespie       (void)*__i;                       // require dereference operator
42103a78d15Sespie     }
42203a78d15Sespie     _Tp __i;
42303a78d15Sespie   };
42403a78d15Sespie 
42503a78d15Sespie   template <class _Tp>
42603a78d15Sespie   struct _Mutable_TrivialIteratorConcept
42703a78d15Sespie   {
42803a78d15Sespie     void __constraints() {
42903a78d15Sespie       __function_requires< _TrivialIteratorConcept<_Tp> >();
43003a78d15Sespie       *__i = *__j;                      // require dereference and assignment
43103a78d15Sespie     }
43203a78d15Sespie     _Tp __i, __j;
43303a78d15Sespie   };
43403a78d15Sespie 
43503a78d15Sespie   template <class _Tp>
43603a78d15Sespie   struct _InputIteratorConcept
43703a78d15Sespie   {
43803a78d15Sespie     void __constraints() {
43903a78d15Sespie       __function_requires< _TrivialIteratorConcept<_Tp> >();
44003a78d15Sespie       // require iterator_traits typedef's
44103a78d15Sespie       typedef typename std::iterator_traits<_Tp>::difference_type _D;
44203a78d15Sespie //      __function_requires< _SignedIntegerConcept<_D> >();
44303a78d15Sespie       typedef typename std::iterator_traits<_Tp>::reference _R;
44403a78d15Sespie       typedef typename std::iterator_traits<_Tp>::pointer _Pt;
44503a78d15Sespie       typedef typename std::iterator_traits<_Tp>::iterator_category _Cat;
44603a78d15Sespie       __function_requires< _ConvertibleConcept<
44703a78d15Sespie         typename std::iterator_traits<_Tp>::iterator_category,
44803a78d15Sespie         std::input_iterator_tag> >();
44903a78d15Sespie       ++__i;                            // require preincrement operator
45003a78d15Sespie       __i++;                            // require postincrement operator
45103a78d15Sespie     }
45203a78d15Sespie     _Tp __i;
45303a78d15Sespie   };
45403a78d15Sespie 
45503a78d15Sespie   template <class _Tp, class _ValueT>
45603a78d15Sespie   struct _OutputIteratorConcept
45703a78d15Sespie   {
45803a78d15Sespie     void __constraints() {
45903a78d15Sespie       __function_requires< _AssignableConcept<_Tp> >();
46003a78d15Sespie       ++__i;                            // require preincrement operator
46103a78d15Sespie       __i++;                            // require postincrement operator
46203a78d15Sespie       *__i++ = __t;                     // require postincrement and assignment
46303a78d15Sespie     }
46403a78d15Sespie     _Tp __i;
46503a78d15Sespie     _ValueT __t;
46603a78d15Sespie   };
46703a78d15Sespie 
46803a78d15Sespie   template <class _Tp>
46903a78d15Sespie   struct _ForwardIteratorConcept
47003a78d15Sespie   {
47103a78d15Sespie     void __constraints() {
47203a78d15Sespie       __function_requires< _InputIteratorConcept<_Tp> >();
47303a78d15Sespie       __function_requires< _ConvertibleConcept<
47403a78d15Sespie         typename std::iterator_traits<_Tp>::iterator_category,
47503a78d15Sespie         std::forward_iterator_tag> >();
47603a78d15Sespie       typedef typename std::iterator_traits<_Tp>::reference _R;
47703a78d15Sespie       _R __r _IsUnused = *__i;
47803a78d15Sespie     }
47903a78d15Sespie     _Tp __i;
48003a78d15Sespie   };
48103a78d15Sespie 
48203a78d15Sespie   template <class _Tp>
48303a78d15Sespie   struct _Mutable_ForwardIteratorConcept
48403a78d15Sespie   {
48503a78d15Sespie     void __constraints() {
48603a78d15Sespie       __function_requires< _ForwardIteratorConcept<_Tp> >();
48703a78d15Sespie       *__i++ = *__i;                    // require postincrement and assignment
48803a78d15Sespie     }
48903a78d15Sespie     _Tp __i;
49003a78d15Sespie   };
49103a78d15Sespie 
49203a78d15Sespie   template <class _Tp>
49303a78d15Sespie   struct _BidirectionalIteratorConcept
49403a78d15Sespie   {
49503a78d15Sespie     void __constraints() {
49603a78d15Sespie       __function_requires< _ForwardIteratorConcept<_Tp> >();
49703a78d15Sespie       __function_requires< _ConvertibleConcept<
49803a78d15Sespie         typename std::iterator_traits<_Tp>::iterator_category,
49903a78d15Sespie         std::bidirectional_iterator_tag> >();
50003a78d15Sespie       --__i;                            // require predecrement operator
50103a78d15Sespie       __i--;                            // require postdecrement operator
50203a78d15Sespie     }
50303a78d15Sespie     _Tp __i;
50403a78d15Sespie   };
50503a78d15Sespie 
50603a78d15Sespie   template <class _Tp>
50703a78d15Sespie   struct _Mutable_BidirectionalIteratorConcept
50803a78d15Sespie   {
50903a78d15Sespie     void __constraints() {
51003a78d15Sespie       __function_requires< _BidirectionalIteratorConcept<_Tp> >();
51103a78d15Sespie       __function_requires< _Mutable_ForwardIteratorConcept<_Tp> >();
51203a78d15Sespie       *__i-- = *__i;                    // require postdecrement and assignment
51303a78d15Sespie     }
51403a78d15Sespie     _Tp __i;
51503a78d15Sespie   };
51603a78d15Sespie 
51703a78d15Sespie 
51803a78d15Sespie   template <class _Tp>
51903a78d15Sespie   struct _RandomAccessIteratorConcept
52003a78d15Sespie   {
52103a78d15Sespie     void __constraints() {
52203a78d15Sespie       __function_requires< _BidirectionalIteratorConcept<_Tp> >();
52303a78d15Sespie       __function_requires< _ComparableConcept<_Tp> >();
52403a78d15Sespie       __function_requires< _ConvertibleConcept<
52503a78d15Sespie         typename std::iterator_traits<_Tp>::iterator_category,
52603a78d15Sespie         std::random_access_iterator_tag> >();
52703a78d15Sespie       // ??? We don't use _R, are we just checking for "referenceability"?
52803a78d15Sespie       typedef typename std::iterator_traits<_Tp>::reference _R;
52903a78d15Sespie 
53003a78d15Sespie       __i += __n;                       // require assignment addition operator
53103a78d15Sespie       __i = __i + __n; __i = __n + __i; // require addition with difference type
53203a78d15Sespie       __i -= __n;                       // require assignment subtraction op
53303a78d15Sespie       __i = __i - __n;                  // require subtraction with
53403a78d15Sespie                                         //            difference type
53503a78d15Sespie       __n = __i - __j;                  // require difference operator
53603a78d15Sespie       (void)__i[__n];                   // require element access operator
53703a78d15Sespie     }
53803a78d15Sespie     _Tp __a, __b;
53903a78d15Sespie     _Tp __i, __j;
54003a78d15Sespie     typename std::iterator_traits<_Tp>::difference_type __n;
54103a78d15Sespie   };
54203a78d15Sespie 
54303a78d15Sespie   template <class _Tp>
54403a78d15Sespie   struct _Mutable_RandomAccessIteratorConcept
54503a78d15Sespie   {
54603a78d15Sespie     void __constraints() {
54703a78d15Sespie       __function_requires< _RandomAccessIteratorConcept<_Tp> >();
54803a78d15Sespie       __function_requires< _Mutable_BidirectionalIteratorConcept<_Tp> >();
54903a78d15Sespie       __i[__n] = *__i;                  // require element access and assignment
55003a78d15Sespie     }
55103a78d15Sespie     _Tp __i;
55203a78d15Sespie     typename std::iterator_traits<_Tp>::difference_type __n;
55303a78d15Sespie   };
55403a78d15Sespie 
55503a78d15Sespie   //===========================================================================
55603a78d15Sespie   // Container Concepts
55703a78d15Sespie 
55803a78d15Sespie   template <class _Container>
55903a78d15Sespie   struct _ContainerConcept
56003a78d15Sespie   {
56103a78d15Sespie     typedef typename _Container::value_type _Value_type;
56203a78d15Sespie     typedef typename _Container::difference_type _Difference_type;
56303a78d15Sespie     typedef typename _Container::size_type _Size_type;
56403a78d15Sespie     typedef typename _Container::const_reference _Const_reference;
56503a78d15Sespie     typedef typename _Container::const_pointer _Const_pointer;
56603a78d15Sespie     typedef typename _Container::const_iterator _Const_iterator;
56703a78d15Sespie 
56803a78d15Sespie     void __constraints() {
56903a78d15Sespie       __function_requires< _InputIteratorConcept<_Const_iterator> >();
57003a78d15Sespie       __function_requires< _AssignableConcept<_Container> >();
57103a78d15Sespie       const _Container __c;
57203a78d15Sespie       __i = __c.begin();
57303a78d15Sespie       __i = __c.end();
57403a78d15Sespie       __n = __c.size();
57503a78d15Sespie       __n = __c.max_size();
57603a78d15Sespie       __b = __c.empty();
57703a78d15Sespie     }
57803a78d15Sespie     bool __b;
57903a78d15Sespie     _Const_iterator __i;
58003a78d15Sespie     _Size_type __n;
58103a78d15Sespie   };
58203a78d15Sespie 
58303a78d15Sespie   template <class _Container>
58403a78d15Sespie   struct _Mutable_ContainerConcept
58503a78d15Sespie   {
58603a78d15Sespie     typedef typename _Container::value_type _Value_type;
58703a78d15Sespie     typedef typename _Container::reference _Reference;
58803a78d15Sespie     typedef typename _Container::iterator _Iterator;
58903a78d15Sespie     typedef typename _Container::pointer _Pointer;
59003a78d15Sespie 
59103a78d15Sespie     void __constraints() {
59203a78d15Sespie       __function_requires< _ContainerConcept<_Container> >();
59303a78d15Sespie       __function_requires< _AssignableConcept<_Value_type> >();
59403a78d15Sespie       __function_requires< _InputIteratorConcept<_Iterator> >();
59503a78d15Sespie 
59603a78d15Sespie       __i = __c.begin();
59703a78d15Sespie       __i = __c.end();
59803a78d15Sespie       __c.swap(__c2);
59903a78d15Sespie     }
60003a78d15Sespie     _Iterator __i;
60103a78d15Sespie     _Container __c, __c2;
60203a78d15Sespie   };
60303a78d15Sespie 
60403a78d15Sespie   template <class _ForwardContainer>
60503a78d15Sespie   struct _ForwardContainerConcept
60603a78d15Sespie   {
60703a78d15Sespie     void __constraints() {
60803a78d15Sespie       __function_requires< _ContainerConcept<_ForwardContainer> >();
60903a78d15Sespie       typedef typename _ForwardContainer::const_iterator _Const_iterator;
61003a78d15Sespie       __function_requires< _ForwardIteratorConcept<_Const_iterator> >();
61103a78d15Sespie     }
61203a78d15Sespie   };
61303a78d15Sespie 
61403a78d15Sespie   template <class _ForwardContainer>
61503a78d15Sespie   struct _Mutable_ForwardContainerConcept
61603a78d15Sespie   {
61703a78d15Sespie     void __constraints() {
61803a78d15Sespie       __function_requires< _ForwardContainerConcept<_ForwardContainer> >();
61903a78d15Sespie       __function_requires< _Mutable_ContainerConcept<_ForwardContainer> >();
62003a78d15Sespie       typedef typename _ForwardContainer::iterator _Iterator;
62103a78d15Sespie       __function_requires< _Mutable_ForwardIteratorConcept<_Iterator> >();
62203a78d15Sespie     }
62303a78d15Sespie   };
62403a78d15Sespie 
62503a78d15Sespie   template <class _ReversibleContainer>
62603a78d15Sespie   struct _ReversibleContainerConcept
62703a78d15Sespie   {
62803a78d15Sespie     typedef typename _ReversibleContainer::const_iterator _Const_iterator;
62903a78d15Sespie     typedef typename _ReversibleContainer::const_reverse_iterator
63003a78d15Sespie       _Const_reverse_iterator;
63103a78d15Sespie 
63203a78d15Sespie     void __constraints() {
63303a78d15Sespie       __function_requires< _ForwardContainerConcept<_ReversibleContainer> >();
63403a78d15Sespie       __function_requires< _BidirectionalIteratorConcept<_Const_iterator> >();
63503a78d15Sespie       __function_requires<
63603a78d15Sespie         _BidirectionalIteratorConcept<_Const_reverse_iterator> >();
63703a78d15Sespie 
63803a78d15Sespie       const _ReversibleContainer __c;
63903a78d15Sespie       _Const_reverse_iterator __i = __c.rbegin();
64003a78d15Sespie       __i = __c.rend();
64103a78d15Sespie     }
64203a78d15Sespie   };
64303a78d15Sespie 
64403a78d15Sespie   template <class _ReversibleContainer>
64503a78d15Sespie   struct _Mutable_ReversibleContainerConcept
64603a78d15Sespie   {
64703a78d15Sespie     typedef typename _ReversibleContainer::iterator _Iterator;
64803a78d15Sespie     typedef typename _ReversibleContainer::reverse_iterator _Reverse_iterator;
64903a78d15Sespie 
65003a78d15Sespie     void __constraints() {
65103a78d15Sespie       __function_requires<_ReversibleContainerConcept<_ReversibleContainer> >();
65203a78d15Sespie       __function_requires<
65303a78d15Sespie         _Mutable_ForwardContainerConcept<_ReversibleContainer> >();
65403a78d15Sespie       __function_requires<_Mutable_BidirectionalIteratorConcept<_Iterator> >();
65503a78d15Sespie       __function_requires<
65603a78d15Sespie         _Mutable_BidirectionalIteratorConcept<_Reverse_iterator> >();
65703a78d15Sespie 
65803a78d15Sespie       _Reverse_iterator __i = __c.rbegin();
65903a78d15Sespie       __i = __c.rend();
66003a78d15Sespie     }
66103a78d15Sespie     _ReversibleContainer __c;
66203a78d15Sespie   };
66303a78d15Sespie 
66403a78d15Sespie   template <class _RandomAccessContainer>
66503a78d15Sespie   struct _RandomAccessContainerConcept
66603a78d15Sespie   {
66703a78d15Sespie     typedef typename _RandomAccessContainer::size_type _Size_type;
66803a78d15Sespie     typedef typename _RandomAccessContainer::const_reference _Const_reference;
66903a78d15Sespie     typedef typename _RandomAccessContainer::const_iterator _Const_iterator;
67003a78d15Sespie     typedef typename _RandomAccessContainer::const_reverse_iterator
67103a78d15Sespie       _Const_reverse_iterator;
67203a78d15Sespie 
67303a78d15Sespie     void __constraints() {
67403a78d15Sespie       __function_requires<
67503a78d15Sespie         _ReversibleContainerConcept<_RandomAccessContainer> >();
67603a78d15Sespie       __function_requires< _RandomAccessIteratorConcept<_Const_iterator> >();
67703a78d15Sespie       __function_requires<
67803a78d15Sespie         _RandomAccessIteratorConcept<_Const_reverse_iterator> >();
67903a78d15Sespie 
68003a78d15Sespie       const _RandomAccessContainer __c;
68103a78d15Sespie       _Const_reference __r _IsUnused = __c[__n];
68203a78d15Sespie     }
68303a78d15Sespie     _Size_type __n;
68403a78d15Sespie   };
68503a78d15Sespie 
68603a78d15Sespie   template <class _RandomAccessContainer>
68703a78d15Sespie   struct _Mutable_RandomAccessContainerConcept
68803a78d15Sespie   {
68903a78d15Sespie     typedef typename _RandomAccessContainer::size_type _Size_type;
69003a78d15Sespie     typedef typename _RandomAccessContainer::reference _Reference;
69103a78d15Sespie     typedef typename _RandomAccessContainer::iterator _Iterator;
69203a78d15Sespie     typedef typename _RandomAccessContainer::reverse_iterator _Reverse_iterator;
69303a78d15Sespie 
69403a78d15Sespie     void __constraints() {
69503a78d15Sespie       __function_requires<
69603a78d15Sespie         _RandomAccessContainerConcept<_RandomAccessContainer> >();
69703a78d15Sespie       __function_requires<
69803a78d15Sespie         _Mutable_ReversibleContainerConcept<_RandomAccessContainer> >();
69903a78d15Sespie       __function_requires< _Mutable_RandomAccessIteratorConcept<_Iterator> >();
70003a78d15Sespie       __function_requires<
70103a78d15Sespie         _Mutable_RandomAccessIteratorConcept<_Reverse_iterator> >();
70203a78d15Sespie 
70303a78d15Sespie       _Reference __r _IsUnused = __c[__i];
70403a78d15Sespie     }
70503a78d15Sespie     _Size_type __i;
70603a78d15Sespie     _RandomAccessContainer __c;
70703a78d15Sespie   };
70803a78d15Sespie 
70903a78d15Sespie   // A Sequence is inherently mutable
71003a78d15Sespie   template <class _Sequence>
71103a78d15Sespie   struct _SequenceConcept
71203a78d15Sespie   {
71303a78d15Sespie     typedef typename _Sequence::reference _Reference;
71403a78d15Sespie     typedef typename _Sequence::const_reference _Const_reference;
71503a78d15Sespie 
71603a78d15Sespie     void __constraints() {
71703a78d15Sespie       // Matt Austern's book puts DefaultConstructible here, the C++
71803a78d15Sespie       // standard places it in Container
71903a78d15Sespie       //    function_requires< DefaultConstructible<Sequence> >();
72003a78d15Sespie       __function_requires< _Mutable_ForwardContainerConcept<_Sequence> >();
72103a78d15Sespie       __function_requires< _DefaultConstructibleConcept<_Sequence> >();
72203a78d15Sespie 
72303a78d15Sespie       _Sequence
72403a78d15Sespie         __c(__n) _IsUnused,
72503a78d15Sespie         __c2(__n, __t) _IsUnused,
72603a78d15Sespie         __c3(__first, __last) _IsUnused;
72703a78d15Sespie 
72803a78d15Sespie       __c.insert(__p, __t);
72903a78d15Sespie       __c.insert(__p, __n, __t);
73003a78d15Sespie       __c.insert(__p, __first, __last);
73103a78d15Sespie 
73203a78d15Sespie       __c.erase(__p);
73303a78d15Sespie       __c.erase(__p, __q);
73403a78d15Sespie 
73503a78d15Sespie       _Reference __r _IsUnused = __c.front();
73603a78d15Sespie 
73703a78d15Sespie       __const_constraints(__c);
73803a78d15Sespie     }
73903a78d15Sespie     void __const_constraints(const _Sequence& __c) {
74003a78d15Sespie       _Const_reference __r _IsUnused = __c.front();
74103a78d15Sespie     }
74203a78d15Sespie     typename _Sequence::value_type __t;
74303a78d15Sespie     typename _Sequence::size_type __n;
74403a78d15Sespie     typename _Sequence::value_type *__first, *__last;
74503a78d15Sespie     typename _Sequence::iterator __p, __q;
74603a78d15Sespie   };
74703a78d15Sespie 
74803a78d15Sespie   template <class _FrontInsertionSequence>
74903a78d15Sespie   struct _FrontInsertionSequenceConcept
75003a78d15Sespie   {
75103a78d15Sespie     void __constraints() {
75203a78d15Sespie       __function_requires< _SequenceConcept<_FrontInsertionSequence> >();
75303a78d15Sespie 
75403a78d15Sespie       __c.push_front(__t);
75503a78d15Sespie       __c.pop_front();
75603a78d15Sespie     }
75703a78d15Sespie     _FrontInsertionSequence __c;
75803a78d15Sespie     typename _FrontInsertionSequence::value_type __t;
75903a78d15Sespie   };
76003a78d15Sespie 
76103a78d15Sespie   template <class _BackInsertionSequence>
76203a78d15Sespie   struct _BackInsertionSequenceConcept
76303a78d15Sespie   {
76403a78d15Sespie     typedef typename _BackInsertionSequence::reference _Reference;
76503a78d15Sespie     typedef typename _BackInsertionSequence::const_reference _Const_reference;
76603a78d15Sespie 
76703a78d15Sespie     void __constraints() {
76803a78d15Sespie       __function_requires< _SequenceConcept<_BackInsertionSequence> >();
76903a78d15Sespie 
77003a78d15Sespie       __c.push_back(__t);
77103a78d15Sespie       __c.pop_back();
77203a78d15Sespie       _Reference __r _IsUnused = __c.back();
77303a78d15Sespie     }
77403a78d15Sespie     void __const_constraints(const _BackInsertionSequence& __c) {
77503a78d15Sespie       _Const_reference __r _IsUnused = __c.back();
77603a78d15Sespie     };
77703a78d15Sespie     _BackInsertionSequence __c;
77803a78d15Sespie     typename _BackInsertionSequence::value_type __t;
77903a78d15Sespie   };
78003a78d15Sespie 
78103a78d15Sespie   template <class _AssociativeContainer>
78203a78d15Sespie   struct _AssociativeContainerConcept
78303a78d15Sespie   {
78403a78d15Sespie     void __constraints() {
78503a78d15Sespie       __function_requires< _ForwardContainerConcept<_AssociativeContainer> >();
78603a78d15Sespie       __function_requires<
78703a78d15Sespie         _DefaultConstructibleConcept<_AssociativeContainer> >();
78803a78d15Sespie 
78903a78d15Sespie       __i = __c.find(__k);
79003a78d15Sespie       __r = __c.equal_range(__k);
79103a78d15Sespie       __c.erase(__k);
79203a78d15Sespie       __c.erase(__i);
79303a78d15Sespie       __c.erase(__r.first, __r.second);
79403a78d15Sespie       __const_constraints(__c);
79503a78d15Sespie     }
79603a78d15Sespie     void __const_constraints(const _AssociativeContainer& __c) {
79703a78d15Sespie       __ci = __c.find(__k);
79803a78d15Sespie       __n = __c.count(__k);
79903a78d15Sespie       __cr = __c.equal_range(__k);
80003a78d15Sespie     }
80103a78d15Sespie     typedef typename _AssociativeContainer::iterator _Iterator;
80203a78d15Sespie     typedef typename _AssociativeContainer::const_iterator _Const_iterator;
80303a78d15Sespie 
80403a78d15Sespie     _AssociativeContainer __c;
80503a78d15Sespie     _Iterator __i;
80603a78d15Sespie     std::pair<_Iterator,_Iterator> __r;
80703a78d15Sespie     _Const_iterator __ci;
80803a78d15Sespie     std::pair<_Const_iterator,_Const_iterator> __cr;
80903a78d15Sespie     typename _AssociativeContainer::key_type __k;
81003a78d15Sespie     typename _AssociativeContainer::size_type __n;
81103a78d15Sespie   };
81203a78d15Sespie 
81303a78d15Sespie   template <class _UniqueAssociativeContainer>
81403a78d15Sespie   struct _UniqueAssociativeContainerConcept
81503a78d15Sespie   {
81603a78d15Sespie     void __constraints() {
81703a78d15Sespie       __function_requires<
81803a78d15Sespie         _AssociativeContainerConcept<_UniqueAssociativeContainer> >();
81903a78d15Sespie 
82003a78d15Sespie       _UniqueAssociativeContainer __c(__first, __last);
82103a78d15Sespie 
82203a78d15Sespie       __pos_flag = __c.insert(__t);
82303a78d15Sespie       __c.insert(__first, __last);
82403a78d15Sespie     }
82503a78d15Sespie     std::pair<typename _UniqueAssociativeContainer::iterator, bool> __pos_flag;
82603a78d15Sespie     typename _UniqueAssociativeContainer::value_type __t;
82703a78d15Sespie     typename _UniqueAssociativeContainer::value_type *__first, *__last;
82803a78d15Sespie   };
82903a78d15Sespie 
83003a78d15Sespie   template <class _MultipleAssociativeContainer>
83103a78d15Sespie   struct _MultipleAssociativeContainerConcept
83203a78d15Sespie   {
83303a78d15Sespie     void __constraints() {
83403a78d15Sespie       __function_requires<
83503a78d15Sespie         _AssociativeContainerConcept<_MultipleAssociativeContainer> >();
83603a78d15Sespie 
83703a78d15Sespie       _MultipleAssociativeContainer __c(__first, __last);
83803a78d15Sespie 
83903a78d15Sespie       __pos = __c.insert(__t);
84003a78d15Sespie       __c.insert(__first, __last);
84103a78d15Sespie 
84203a78d15Sespie     }
84303a78d15Sespie     typename _MultipleAssociativeContainer::iterator __pos _IsUnused;
84403a78d15Sespie     typename _MultipleAssociativeContainer::value_type __t;
84503a78d15Sespie     typename _MultipleAssociativeContainer::value_type *__first, *__last;
84603a78d15Sespie   };
84703a78d15Sespie 
84803a78d15Sespie   template <class _SimpleAssociativeContainer>
84903a78d15Sespie   struct _SimpleAssociativeContainerConcept
85003a78d15Sespie   {
85103a78d15Sespie     void __constraints() {
85203a78d15Sespie       __function_requires<
85303a78d15Sespie         _AssociativeContainerConcept<_SimpleAssociativeContainer> >();
85403a78d15Sespie       typedef typename _SimpleAssociativeContainer::key_type _Key_type;
85503a78d15Sespie       typedef typename _SimpleAssociativeContainer::value_type _Value_type;
85603a78d15Sespie       typedef typename _Aux_require_same<_Key_type, _Value_type>::_Type
85703a78d15Sespie         _Requqired;
85803a78d15Sespie     }
85903a78d15Sespie   };
86003a78d15Sespie 
86103a78d15Sespie   template <class _SimpleAssociativeContainer>
86203a78d15Sespie   struct _PairAssociativeContainerConcept
86303a78d15Sespie   {
86403a78d15Sespie     void __constraints() {
86503a78d15Sespie       __function_requires<
86603a78d15Sespie         _AssociativeContainerConcept<_SimpleAssociativeContainer> >();
86703a78d15Sespie       typedef typename _SimpleAssociativeContainer::key_type _Key_type;
86803a78d15Sespie       typedef typename _SimpleAssociativeContainer::value_type _Value_type;
86903a78d15Sespie       typedef typename _SimpleAssociativeContainer::mapped_type _Mapped_type;
87003a78d15Sespie       typedef std::pair<const _Key_type, _Mapped_type> _Required_value_type;
87103a78d15Sespie       typedef typename _Aux_require_same<_Value_type,
87203a78d15Sespie         _Required_value_type>::_Type _Required;
87303a78d15Sespie     }
87403a78d15Sespie   };
87503a78d15Sespie 
87603a78d15Sespie   template <class _SortedAssociativeContainer>
87703a78d15Sespie   struct _SortedAssociativeContainerConcept
87803a78d15Sespie   {
87903a78d15Sespie     void __constraints() {
88003a78d15Sespie       __function_requires<
88103a78d15Sespie         _AssociativeContainerConcept<_SortedAssociativeContainer> >();
88203a78d15Sespie       __function_requires<
88303a78d15Sespie         _ReversibleContainerConcept<_SortedAssociativeContainer> >();
88403a78d15Sespie 
88503a78d15Sespie       _SortedAssociativeContainer
88603a78d15Sespie         __c(__kc) _IsUnused,
88703a78d15Sespie         __c2(__first, __last) _IsUnused,
88803a78d15Sespie         __c3(__first, __last, __kc) _IsUnused;
88903a78d15Sespie 
89003a78d15Sespie       __p = __c.upper_bound(__k);
89103a78d15Sespie       __p = __c.lower_bound(__k);
89203a78d15Sespie       __r = __c.equal_range(__k);
89303a78d15Sespie 
89403a78d15Sespie       __c.insert(__p, __t);
89503a78d15Sespie     }
89603a78d15Sespie     void __const_constraints(const _SortedAssociativeContainer& __c) {
89703a78d15Sespie       __kc = __c.key_comp();
89803a78d15Sespie       __vc = __c.value_comp();
89903a78d15Sespie 
90003a78d15Sespie       __cp = __c.upper_bound(__k);
90103a78d15Sespie       __cp = __c.lower_bound(__k);
90203a78d15Sespie       __cr = __c.equal_range(__k);
90303a78d15Sespie     }
90403a78d15Sespie     typename _SortedAssociativeContainer::key_compare __kc;
90503a78d15Sespie     typename _SortedAssociativeContainer::value_compare __vc;
90603a78d15Sespie     typename _SortedAssociativeContainer::value_type __t;
90703a78d15Sespie     typename _SortedAssociativeContainer::key_type __k;
90803a78d15Sespie     typedef typename _SortedAssociativeContainer::iterator _Iterator;
90903a78d15Sespie     typedef typename _SortedAssociativeContainer::const_iterator
91003a78d15Sespie       _Const_iterator;
91103a78d15Sespie 
91203a78d15Sespie     _Iterator __p;
91303a78d15Sespie     _Const_iterator __cp;
91403a78d15Sespie     std::pair<_Iterator,_Iterator> __r;
91503a78d15Sespie     std::pair<_Const_iterator,_Const_iterator> __cr;
91603a78d15Sespie     typename _SortedAssociativeContainer::value_type *__first, *__last;
91703a78d15Sespie   };
91803a78d15Sespie 
91903a78d15Sespie   // HashedAssociativeContainer
92003a78d15Sespie 
92103a78d15Sespie } // namespace __gnu_cxx
92203a78d15Sespie 
92303a78d15Sespie #undef _IsUnused
92403a78d15Sespie 
92503a78d15Sespie #endif // _GLIBCPP_BOOST_CONCEPT_CHECK
92603a78d15Sespie 
92703a78d15Sespie 
928