Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.6 2000/12/03 23:47:47 jsm28 Exp $
+the mailing list.
+ $Id: howto.html,v 1.1 2000/12/10 04:03:09 pme Exp $
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.7 2000/12/03 23:47:47 jsm28 Exp $
+the mailing list.
+ $Id: howto.html,v 1.1 2000/12/10 04:04:54 pme Exp $
Good news: As part of their 3.3 release, SGI
- added some nifty macros which
- perform assertions on type properties. For example, the Standard
- requires that types passed as template parameters to vector
- be "Assignable" (which means what you think it means).
+
In 1999, SGI added concept checkers to their implementation
+ of the STL: code which checked the template parameters of
+ instantiated pieces of the STL, in order to insure that the parameters
+ being used met the requirements of the standard. For example,
+ the Standard requires that types passed as template parameters to
+ vector be "Assignable" (which means what you think
+ it means). The checking was done during compilation, and none of
+ the code was executed at runtime.
-
The concept checkers allow the source code for vector to
- declare
-
- __STL_CLASS_REQUIRES(_Tp, _Assignable);
-
inside the template. _Tp is the element type of the
- vector, and _Assignable is the concept to be checked (it is
- defined in some back-end header files). When you instantiate
- vector<MyType>, compile-time checking can be done on
- whether MyType meets the requirements for vectors.
+
Unfortunately, the size of the compiler files grew significantly
+ as a result. The checking code itself was cumbersome. And bugs
+ were found in it on more than one occasion.
-
Most (all?) of the containers and sequences are capable of performing
- concept checking during compilation, not just vector.
+
The primary author of the checking code, Jeremy Siek, had already
+ started work on a replcement implementation. The new code has been
+ formally reviewed and accepted into
+ the
+ Boost libraries, and we are pleased to incorporate it into the
+ GNU C++ library.
-
If a concept is violated (thus causing a compilation failure), the
- error messages printed by the compiler will be of the form
-
- _STL_ERROR::__foo_violation
-
where foo is a description of the precise violation.
- For example, if a type is required to support the preincrement
- operator but doesn't, then you will see
- _STL_ERROR::__postincrement_operator_requirement_violation, which
- should give you a hint as to the nature of the problem.
+
The new version imposes a much smaller space overhead on the generated
+ object file. The checks are also cleaner and easier to read and
+ understand.
-
Other names might be seen for more specific errors, for example,
- _ERROR_IN_STL_CONTAINER::__begin_iterator_accessor_requirement_violation.
+
Concept checking can be disabled when you build your code, for example,
+ to save space during a production build. Just define (via -D or
+ #define) any of the macros
+ _GLIBCPP_NO_CONCEPT_CHECKS (yes, with the leading underscore),
+ _STL_NO_CONCEPT_CHECKS (also with the leading underscore),
+ or NDEBUG. The first macro is specifically for this
+ feature, the second is the disabling macro for the replaced SGI
+ version (some code may assume SGI's version is in use), and the third
+ is the usual macro to disable assert(), which is often turned
+ off for production builds.
-
You will probably also see other errors as the malformed code is
- actually used. The concept checking error messages should be printed
- before the others, so start at the top and work your way down.
-
-
Bad news: The current checking code is somewhat
- messy. It results in no runtime overhead, but there is a space
- penalty (sometimes a very large one) in the generated code. And the
- code itself has bugs.
-
-
Concept checking can be disabled when you build your code. Just
- define (via -D or #define) the macro
- _STL_NO_CONCEPT_CHECKS (yes, with the leading underscore).
- In fact, this may already be defined in the library by default,
- depending on what decision we come to.
-
-
More good news: Replacement code has already been
- written by the same author of the original code. It's available at
- Boost and we hope to integrate it into the library.
+
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.1 2000/12/10 04:04:54 pme Exp $
+the mailing list.
+ $Id: howto.html,v 1.2 2001/03/25 00:01:56 pme Exp $
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.1 2000/12/10 04:04:54 pme Exp $
+the mailing list.
+ $Id: howto.html,v 1.2 2001/01/23 17:02:27 pme Exp $
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
+the mailing list.
+ $Id: howto.html,v 1.2 2001/02/07 00:03:20 pme Exp $
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
+the mailing list.
+ $Id: howto.html,v 1.2 2001/02/07 00:03:20 pme Exp $
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.4 2000/12/03 23:47:48 jsm28 Exp $
+the mailing list.
+ $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.5 2000/12/03 23:47:48 jsm28 Exp $
+the mailing list.
+ $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.5 2000/12/03 23:47:48 jsm28 Exp $
+the mailing list.
+ $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.7 2000/12/03 23:47:48 jsm28 Exp $
+the mailing list.
+ $Id: howto.html,v 1.1 2000/12/10 04:04:56 pme Exp $
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.2 2001/01/23 17:02:27 pme Exp $
+the mailing list.
+ $Id: howto.html,v 1.3 2001/02/07 00:03:21 pme Exp $
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: howto.html,v 1.1 2000/12/10 04:04:56 pme Exp $
+the mailing list.
+ $Id: howto.html,v 1.2 2001/03/25 00:01:56 pme Exp $
diff --git a/libstdc++-v3/docs/html/faq/index.html b/libstdc++-v3/docs/html/faq/index.html
index 95ab8fbdb29..80bb2567e5d 100644
--- a/libstdc++-v3/docs/html/faq/index.html
+++ b/libstdc++-v3/docs/html/faq/index.html
@@ -9,7 +9,7 @@
** Locations of "the most recent snapshot is the Nth" text are
** answers 1_1, 1_4, 4_1, 5_6.
-->
-
+
@@ -62,15 +62,16 @@ http://gcc.gnu.org/onlinedocs/libstdc++/faq/.
Aw, that's easy to fix!
@@ -258,7 +259,7 @@ which is no longer available, thanks deja...-->
that building GCC is much easier and more automated
than building the GCC 2.[78] series was.
If you plan on hacking around with the makefiles, you
- will need the tools autoconfand automake.
GNU Make is the only make that supports these makefiles.
@@ -289,11 +290,11 @@ HREF="http://sources.redhat.com/automake/">automake.
keep mentioning?
The "anonymous client checkout" feature of CVS is
similar to anonymous FTP in that it allows anyone to retrieve
@@ -371,7 +372,7 @@ HREF="http://sources.redhat.com/automake/">automake.
You have two options. You can get a newer cygwin1.dll (see the
Cygwin paragraph in the
- installation instructions).
+ installation instructions).
Or you can get a prebuilt set of bits/std_limits.h and
src/limitsMEMBERS.cc files from Mumit Khan's
Cygwin-related website.
@@ -381,15 +382,15 @@ HREF="http://sources.redhat.com/automake/">automake.
The atomicity.h header for the Alpha processor
currently uses pseudo-operators which the DEC assembler
- doesn't understand (in particular, .subsection and .previous).
- The simple solution is to install GNU as and arrange
- for the GCC build to use it (or merge the sources and build
- it during the bootstrap).
+ doesn't understand (in particular, .subsection and .previous).
+ The simple solution is to install GNU as and arrange
+ for the GCC build to use it (or merge the sources and build
+ it during the bootstrap).
Anyone who
knows
- the DEC assembler well enough to provide the equivalent of
- these two pseudos would win praise and accolades from many.
+ the DEC assembler well enough to provide the equivalent of
+ these two pseudos would win praise and accolades from many.
@@ -511,12 +512,12 @@ to the list, Nathan Myers announced that he has started a list of
More information, including how to optionally disable the checks,
+ is available here.
@@ -579,7 +580,7 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
on submitting
patches that covers the procedure, but for libstdc++ you
should also send the patch to our mailing list in addition to
- the GCC patches mailing list. The libstdc++
+ the GCC patches mailing list. The libstdc++
contributors' page
also talks about how to submit patches.
@@ -720,9 +721,8 @@ HREF="http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html">speculation.
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: index.html,v 1.4 2001/03/01 22:32:23 pme Exp $
+the mailing list.
+ $Id: index.html,v 1.5 2001/03/25 00:01:57 pme Exp $
diff --git a/libstdc++-v3/docs/html/faq/index.txt b/libstdc++-v3/docs/html/faq/index.txt
index 8af6565324b..9ad8712f35e 100644
--- a/libstdc++-v3/docs/html/faq/index.txt
+++ b/libstdc++-v3/docs/html/faq/index.txt
@@ -38,7 +38,7 @@
header
o [28]The g++-3 headers are not ours
o [29]compilation errors from streambuf.h
- o [30]_STL_ERROR::__something_huge_...
+ o [30]errors about *Cconcept and constraints in the STL...
5. [31]Aw, that's easy to fix!
5. [32]Miscellaneous
1. [33]string::iterator is not char*; vector::iterator is not
@@ -440,18 +440,16 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
Note that 2.95.x shipped with the [68]old v2 library which is no
longer maintained.
- If you see compilation errors containing messages which begin with
- _STL_ERROR:: followed by a very verbose name, then most likely you
- have violated one of the requirements for types used during
- instantiation of template containers. For example,
- _STL_ERROR::__equality_comparable_requirement_violation appears if
- your types must be comparable with == and you have not provided this
+ If you see compilation errors containing messages about fooConcept and
+ a constraints member function, then most likely you have violated one
+ of the requirements for types used during instantiation of template
+ containers. For example, EqualityComparableConcept appears if your
+ types must be comparable with == and you have not provided this
capability (a typo, or wrong visibility, or you just plain forgot,
etc).
More information, including how to optionally disable the checks, is
- available [69]here. The code itself might be disabled or replaced
- already.
+ available [69]here.
_________________________________________________________________
4.5 Aw, that's easy to fix!
@@ -573,9 +571,9 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
out!
_________________________________________________________________
- Comments and suggestions are welcome, and may be sent to [83]Phil
- Edwards or [84]Gabriel Dos Reis.
- $Id: index.html,v 1.4 2001/03/01 22:32:23 pme Exp $
+ Comments and suggestions are welcome, and may be sent to [83]the
+ mailing list.
+ $Id: index.html,v 1.5 2001/03/25 00:01:57 pme Exp $
References
@@ -661,5 +659,4 @@ References
80. http://www.ansi.org/
81. http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998
82. http://www.iso.ch/
- 83. mailto:pme@sources.redhat.com
- 84. mailto:gdr@gcc.gnu.org
+ 83. mailto:libstdc++@gcc.gnu.org
diff --git a/libstdc++-v3/docs/html/install.html b/libstdc++-v3/docs/html/install.html
index fcc0c0dcdce..24df89ba096 100644
--- a/libstdc++-v3/docs/html/install.html
+++ b/libstdc++-v3/docs/html/install.html
@@ -7,7 +7,7 @@
libstdc++-v3 Installation Instructions
-
+
@@ -333,9 +333,8 @@
Comments and suggestions are welcome, and may be sent to
-Phil Edwards or
-Gabriel Dos Reis.
- $Id: install.html,v 1.3 2001/01/23 17:02:26 pme Exp $
+the mailing list.
+ $Id: install.html,v 1.4 2001/02/07 00:03:20 pme Exp $
diff --git a/libstdc++-v3/include/bits/boost_concept_check.h b/libstdc++-v3/include/bits/boost_concept_check.h
new file mode 100644
index 00000000000..1142e049618
--- /dev/null
+++ b/libstdc++-v3/include/bits/boost_concept_check.h
@@ -0,0 +1,887 @@
+//
+// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
+// sell and distribute this software is granted provided this
+// copyright notice appears in all copies. This software is provided
+// "as is" without express or implied warranty, and with no claim as
+// to its suitability for any purpose.
+//
+
+// GCC Note: based on version 1.12.0 of the Boost library.
+#ifndef BOOST_CONCEPT_CHECKS_HPP
+#define BOOST_CONCEPT_CHECKS_HPP
+
+#pragma GCC system_header
+#include // for traits and tags
+#include // for pair<>
+
+
+namespace boost {
+
+template void ignore_unused_variable_warning(const T&) { }
+
+template
+void function_requires()
+{
+ void (Concept::*x)() = &Concept::constraints;
+ ignore_unused_variable_warning(x);
+}
+
+
+#define BOOST_CLASS_REQUIRES(type_var, ns, concept) \
+ typedef void (ns::concept ::* func##type_var##concept)(); \
+ template \
+ struct concept_checking_##type_var##concept { }; \
+ typedef concept_checking_##type_var##concept< \
+ &ns::concept ::constraints> \
+ concept_checking_typedef_##type_var##concept
+
+#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, ns, concept) \
+ typedef void (ns::concept ::* func##type_var1##type_var2##concept)(); \
+ template \
+ struct concept_checking_##type_var1##type_var2##concept { }; \
+ typedef concept_checking_##type_var1##type_var2##concept< \
+ &ns::concept ::constraints> \
+ concept_checking_typedef_##type_var1##type_var2##concept
+
+#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, ns, concept) \
+ typedef void (ns::concept ::* func##type_var1##type_var2##type_var3##concept)(); \
+ template \
+ struct concept_checking_##type_var1##type_var2##type_var3##concept { }; \
+ typedef concept_checking_##type_var1##type_var2##type_var3##concept< \
+ &ns::concept ::constraints> \
+ concept_checking_typedef_##type_var1##type_var2##type_var3##concept
+
+#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, ns, concept) \
+ typedef void (ns::concept ::* func##type_var1##type_var2##type_var3##type_var4##concept)(); \
+ template \
+ struct concept_checking_##type_var1##type_var2##type_var3##type_var4##concept { }; \
+ typedef concept_checking_##type_var1##type_var2##type_var3##type_var4##concept< \
+ &ns::concept ::constraints> \
+ concept_checking_typedef_##type_var1##type_var2##type_var3##type_var4##concept
+
+
+template
+struct require_same { };
+
+template
+struct require_same { typedef T type; };
+
+ template
+ struct SameTypeConcept
+ {
+ void constraints() {
+ typedef typename require_same::type req;
+ }
+ };
+
+ template
+ struct IntegerConcept {
+ void constraints() {
+ errortype_must_be_an_integer_type();
+ }
+ };
+ template <> struct IntegerConcept { void constraints() {} };
+ template <> struct IntegerConcept { void constraints() {} };
+ template <> struct IntegerConcept { void constraints() {} };
+ template <> struct IntegerConcept { void constraints() {} };
+ template <> struct IntegerConcept { void constraints() {} };
+ template <> struct IntegerConcept { void constraints() {} };
+ // etc.
+
+ template
+ struct SignedIntegerConcept {
+ void constraints() {
+ errortype_must_be_a_signed_integer_type();
+ }
+ };
+ template <> struct SignedIntegerConcept { void constraints() {} };
+ template <> struct SignedIntegerConcept { void constraints() {} };
+ template <> struct SignedIntegerConcept { void constraints() {} };
+ // etc.
+
+ template
+ struct UnsignedIntegerConcept {
+ void constraints() {
+ errortype_must_be_an_unsigned_integer_type();
+ }
+ };
+ template <> struct UnsignedIntegerConcept
+ { void constraints() {} };
+ template <> struct UnsignedIntegerConcept
+ { void constraints() {} };
+ template <> struct UnsignedIntegerConcept
+ { void constraints() {} };
+ // etc.
+
+ //===========================================================================
+ // Basic Concepts
+
+ template
+ struct DefaultConstructibleConcept
+ {
+ void constraints() {
+ TT a; // require default constructor
+ ignore_unused_variable_warning(a);
+ }
+ };
+
+ template
+ struct AssignableConcept
+ {
+ void constraints() {
+ a = a; // require assignment operator
+ const_constraints(a);
+ }
+ void const_constraints(const TT& b) {
+ a = b; // const required for argument to assignment
+ }
+ TT a;
+ };
+
+ template
+ struct CopyConstructibleConcept
+ {
+ void constraints() {
+ TT a(b); // require copy constructor
+ TT* ptr = &a; // require address of operator
+ const_constraints(a);
+ ignore_unused_variable_warning(ptr);
+ }
+ void const_constraints(const TT& a) {
+ TT c(a); // require const copy constructor
+ const TT* ptr = &a; // require const address of operator
+ ignore_unused_variable_warning(c);
+ ignore_unused_variable_warning(ptr);
+ }
+ TT b;
+ };
+
+ // The SGI STL version of Assignable requires copy constructor and operator=
+ template
+ struct SGIAssignableConcept
+ {
+ void constraints() {
+ TT b(a);
+ a = a; // require assignment operator
+ const_constraints(a);
+ ignore_unused_variable_warning(b);
+ }
+ void const_constraints(const TT& b) {
+ TT c(b);
+ a = b; // const required for argument to assignment
+ ignore_unused_variable_warning(c);
+ }
+ TT a;
+ };
+
+ template
+ struct ConvertibleConcept
+ {
+ void constraints() {
+ Y y = x;
+ ignore_unused_variable_warning(y);
+ }
+ X x;
+ };
+
+ // The C++ standard requirements for many concepts talk about return
+ // types that must be "convertible to bool". The problem with this
+ // requirement is that it leaves the door open for evil proxies that
+ // define things like operator|| with strange return types. Two
+ // possible solutions are:
+ // 1) require the return type to be exactly bool
+ // 2) stay with convertible to bool, and also
+ // specify stuff about all the logical operators.
+ // For now we just test for convertible to bool.
+ template
+ void require_boolean_expr(const TT& t) {
+ bool x = t;
+ ignore_unused_variable_warning(x);
+ }
+
+ template
+ struct EqualityComparableConcept
+ {
+ void constraints() {
+ require_boolean_expr(a == b);
+ require_boolean_expr(a != b);
+ }
+ TT a, b;
+ };
+
+ template
+ struct LessThanComparableConcept
+ {
+ void constraints() {
+ require_boolean_expr(a < b);
+ }
+ TT a, b;
+ };
+
+ // This is equivalent to SGI STL's LessThanComparable.
+ template
+ struct ComparableConcept
+ {
+ void constraints() {
+ require_boolean_expr(a < b);
+ require_boolean_expr(a > b);
+ require_boolean_expr(a <= b);
+ require_boolean_expr(a >= b);
+ }
+ TT a, b;
+ };
+
+#define BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(OP,NAME) \
+ template \
+ struct NAME { \
+ void constraints() { (void)constraints_(); } \
+ bool constraints_() { \
+ return a OP b; \
+ } \
+ First a; \
+ Second b; \
+ }
+
+#define BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(OP,NAME) \
+ template \
+ struct NAME { \
+ void constraints() { (void)constraints_(); } \
+ Ret constraints_() { \
+ return a OP b; \
+ } \
+ First a; \
+ Second b; \
+ }
+
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, EqualOpConcept);
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, NotEqualOpConcept);
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, LessThanOpConcept);
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, LessEqualOpConcept);
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, GreaterThanOpConcept);
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, GreaterEqualOpConcept);
+
+ BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, PlusOpConcept);
+ BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, TimesOpConcept);
+ BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, DivideOpConcept);
+ BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, SubtractOpConcept);
+ BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, ModOpConcept);
+
+#undef BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT
+#undef BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT
+
+ //===========================================================================
+ // Function Object Concepts
+
+ template
+ struct GeneratorConcept
+ {
+ void constraints() {
+ const Return& r = f(); // require operator() member function
+ ignore_unused_variable_warning(r);
+ }
+ Func f;
+ };
+
+
+ template
+ struct GeneratorConcept
+ {
+ void constraints() {
+ f(); // require operator() member function
+ }
+ Func f;
+ };
+
+ template
+ struct UnaryFunctionConcept
+ {
+ void constraints() {
+ r = f(arg); // require operator()
+ }
+ Func f;
+ Arg arg;
+ Return r;
+ };
+
+ template
+ struct UnaryFunctionConcept {
+ void constraints() {
+ f(arg); // require operator()
+ }
+ Func f;
+ };
+
+ template
+ struct BinaryFunctionConcept
+ {
+ void constraints() {
+ r = f(first, second); // require operator()
+ }
+ Func f;
+ First first;
+ Second second;
+ Return r;
+ };
+
+ template
+ struct BinaryFunctionConcept
+ {
+ void constraints() {
+ f(first, second); // require operator()
+ }
+ Func f;
+ First first;
+ Second second;
+ };
+
+ template
+ struct UnaryPredicateConcept
+ {
+ void constraints() {
+ require_boolean_expr(f(arg)); // require operator() returning bool
+ }
+ Func f;
+ Arg arg;
+ };
+
+ template
+ struct BinaryPredicateConcept
+ {
+ void constraints() {
+ require_boolean_expr(f(a, b)); // require operator() returning bool
+ }
+ Func f;
+ First a;
+ Second b;
+ };
+
+ // use this when functor is used inside a container class like std::set
+ template
+ struct Const_BinaryPredicateConcept {
+ void constraints() {
+ const_constraints(f);
+ }
+ void const_constraints(const Func& fun) {
+ function_requires >();
+ // operator() must be a const member function
+ require_boolean_expr(fun(a, b));
+ }
+ Func f;
+ First a;
+ Second b;
+ };
+
+ //===========================================================================
+ // Iterator Concepts
+
+ template
+ struct TrivialIteratorConcept
+ {
+ void constraints() {
+ function_requires< AssignableConcept >();
+ function_requires< DefaultConstructibleConcept >();
+ function_requires< EqualityComparableConcept >();
+ typedef typename std::iterator_traits::value_type V;
+ (void)*i; // require dereference operator
+ }
+ TT i;
+ };
+
+ template
+ struct Mutable_TrivialIteratorConcept
+ {
+ void constraints() {
+ function_requires< TrivialIteratorConcept >();
+ *i = *j; // require dereference and assignment
+ }
+ TT i, j;
+ };
+
+ template
+ struct InputIteratorConcept
+ {
+ void constraints() {
+ function_requires< TrivialIteratorConcept >();
+ // require iterator_traits typedef's
+ typedef typename std::iterator_traits::difference_type D;
+ function_requires< SignedIntegerConcept >();
+ typedef typename std::iterator_traits::reference R;
+ typedef typename std::iterator_traits::pointer P;
+ typedef typename std::iterator_traits::iterator_category C;
+ function_requires< ConvertibleConcept<
+ typename std::iterator_traits::iterator_category,
+ std::input_iterator_tag> >();
+ ++i; // require preincrement operator
+ i++; // require postincrement operator
+ }
+ TT i;
+ };
+
+ template
+ struct OutputIteratorConcept
+ {
+ void constraints() {
+ function_requires< AssignableConcept >();
+ ++i; // require preincrement operator
+ i++; // require postincrement operator
+ *i++ = t; // require postincrement and assignment
+ }
+ TT i;
+ ValueT t;
+ };
+
+ template
+ struct ForwardIteratorConcept
+ {
+ void constraints() {
+ function_requires< InputIteratorConcept >();
+ function_requires< ConvertibleConcept<
+ typename std::iterator_traits::iterator_category,
+ std::forward_iterator_tag> >();
+ typedef typename std::iterator_traits::reference reference;
+ reference r = *i;
+ ignore_unused_variable_warning(r);
+ }
+ TT i;
+ };
+
+ template
+ struct Mutable_ForwardIteratorConcept
+ {
+ void constraints() {
+ function_requires< ForwardIteratorConcept >();
+ *i++ = *i; // require postincrement and assignment
+ }
+ TT i;
+ };
+
+ template
+ struct BidirectionalIteratorConcept
+ {
+ void constraints() {
+ function_requires< ForwardIteratorConcept >();
+ function_requires< ConvertibleConcept<
+ typename std::iterator_traits::iterator_category,
+ std::bidirectional_iterator_tag> >();
+ --i; // require predecrement operator
+ i--; // require postdecrement operator
+ }
+ TT i;
+ };
+
+ template
+ struct Mutable_BidirectionalIteratorConcept
+ {
+ void constraints() {
+ function_requires< BidirectionalIteratorConcept >();
+ function_requires< Mutable_ForwardIteratorConcept >();
+ *i-- = *i; // require postdecrement and assignment
+ }
+ TT i;
+ };
+
+
+ template
+ struct RandomAccessIteratorConcept
+ {
+ void constraints() {
+ function_requires< BidirectionalIteratorConcept >();
+ function_requires< ComparableConcept >();
+ function_requires< ConvertibleConcept<
+ typename std::iterator_traits::iterator_category,
+ std::random_access_iterator_tag> >();
+ typedef typename std::iterator_traits::reference R;
+
+ i += n; // require assignment addition operator
+ i = i + n; i = n + i; // require addition with difference type
+ i -= n; // require assignment subtraction operator
+ i = i - n; // require subtraction with difference type
+ n = i - j; // require difference operator
+ (void)i[n]; // require element access operator
+ }
+ TT a, b;
+ TT i, j;
+ typename std::iterator_traits::difference_type n;
+ };
+
+ template
+ struct Mutable_RandomAccessIteratorConcept
+ {
+ void constraints() {
+ function_requires< RandomAccessIteratorConcept >();
+ function_requires< Mutable_BidirectionalIteratorConcept >();
+ i[n] = *i; // require element access and assignment
+ }
+ TT i;
+ typename std::iterator_traits::difference_type n;
+ };
+
+ //===========================================================================
+ // Container Concepts
+
+ template
+ struct ContainerConcept
+ {
+ typedef typename Container::value_type value_type;
+ typedef typename Container::difference_type difference_type;
+ typedef typename Container::size_type size_type;
+ typedef typename Container::const_reference const_reference;
+ typedef typename Container::const_pointer const_pointer;
+ typedef typename Container::const_iterator const_iterator;
+
+ void constraints() {
+ function_requires< InputIteratorConcept >();
+ function_requires< AssignableConcept >();
+ const Container c;
+ i = c.begin();
+ i = c.end();
+ n = c.size();
+ n = c.max_size();
+ b = c.empty();
+ }
+ bool b;
+ const_iterator i;
+ size_type n;
+ };
+
+ template
+ struct Mutable_ContainerConcept
+ {
+ typedef typename Container::value_type value_type;
+ typedef typename Container::reference reference;
+ typedef typename Container::iterator iterator;
+ typedef typename Container::pointer pointer;
+
+ void constraints() {
+ function_requires< ContainerConcept >();
+ function_requires< AssignableConcept >();
+ function_requires< InputIteratorConcept >();
+
+ i = c.begin();
+ i = c.end();
+ c.swap(c2);
+ }
+ iterator i;
+ Container c, c2;
+ };
+
+ template
+ struct ForwardContainerConcept
+ {
+ void constraints() {
+ function_requires< ContainerConcept >();
+ typedef typename ForwardContainer::const_iterator const_iterator;
+ function_requires< ForwardIteratorConcept >();
+ }
+ };
+
+ template
+ struct Mutable_ForwardContainerConcept
+ {
+ void constraints() {
+ function_requires< ForwardContainerConcept >();
+ function_requires< Mutable_ContainerConcept >();
+ typedef typename ForwardContainer::iterator iterator;
+ function_requires< Mutable_ForwardIteratorConcept >();
+ }
+ };
+
+ template
+ struct ReversibleContainerConcept
+ {
+ typedef typename ReversibleContainer::const_iterator const_iterator;
+ typedef typename ReversibleContainer::const_reverse_iterator
+ const_reverse_iterator;
+
+ void constraints() {
+ function_requires< ForwardContainerConcept >();
+ function_requires< BidirectionalIteratorConcept >();
+ function_requires< BidirectionalIteratorConcept >();
+
+ const ReversibleContainer c;
+ const_reverse_iterator i = c.rbegin();
+ i = c.rend();
+ }
+ };
+
+ template
+ struct Mutable_ReversibleContainerConcept
+ {
+ typedef typename ReversibleContainer::iterator iterator;
+ typedef typename ReversibleContainer::reverse_iterator reverse_iterator;
+
+ void constraints() {
+ function_requires< ReversibleContainerConcept >();
+ function_requires< Mutable_ForwardContainerConcept >();
+ function_requires< Mutable_BidirectionalIteratorConcept >();
+ function_requires< Mutable_BidirectionalIteratorConcept >();
+
+ reverse_iterator i = c.rbegin();
+ i = c.rend();
+ }
+ ReversibleContainer c;
+ };
+
+ template
+ struct RandomAccessContainerConcept
+ {
+ typedef typename RandomAccessContainer::size_type size_type;
+ typedef typename RandomAccessContainer::const_reference const_reference;
+ typedef typename RandomAccessContainer::const_iterator const_iterator;
+ typedef typename RandomAccessContainer::const_reverse_iterator
+ const_reverse_iterator;
+
+ void constraints() {
+ function_requires< ReversibleContainerConcept >();
+ function_requires< RandomAccessIteratorConcept >();
+ function_requires< RandomAccessIteratorConcept >();
+
+ const RandomAccessContainer c;
+ const_reference r = c[n];
+ ignore_unused_variable_warning(r);
+ }
+ size_type n;
+ };
+
+ template
+ struct Mutable_RandomAccessContainerConcept
+ {
+ typedef typename RandomAccessContainer::size_type size_type;
+ typedef typename RandomAccessContainer::reference reference;
+ typedef typename RandomAccessContainer::iterator iterator;
+ typedef typename RandomAccessContainer::reverse_iterator reverse_iterator;
+
+ void constraints() {
+ function_requires< RandomAccessContainerConcept >();
+ function_requires< Mutable_ReversibleContainerConcept >();
+ function_requires< Mutable_RandomAccessIteratorConcept >();
+ function_requires< Mutable_RandomAccessIteratorConcept >();
+
+ reference r = c[i];
+ ignore_unused_variable_warning(r);
+ }
+ size_type i;
+ RandomAccessContainer c;
+ };
+
+ // A Sequence is inherently mutable
+ template
+ struct SequenceConcept
+ {
+
+ typedef typename Sequence::reference reference;
+ typedef typename Sequence::const_reference const_reference;
+
+ void constraints() {
+ // Matt Austern's book puts DefaultConstructible here, the C++
+ // standard places it in Container
+ // function_requires< DefaultConstructible >();
+ function_requires< Mutable_ForwardContainerConcept >();
+ function_requires< DefaultConstructibleConcept >();
+
+ Sequence
+ c(n),
+ c2(n, t),
+ c3(first, last);
+
+ c.insert(p, t);
+ c.insert(p, n, t);
+ c.insert(p, first, last);
+
+ c.erase(p);
+ c.erase(p, q);
+
+ reference r = c.front();
+
+ ignore_unused_variable_warning(c);
+ ignore_unused_variable_warning(c2);
+ ignore_unused_variable_warning(c3);
+ ignore_unused_variable_warning(r);
+ const_constraints(c);
+ }
+ void const_constraints(const Sequence& c) {
+ const_reference r = c.front();
+ ignore_unused_variable_warning(r);
+ }
+ typename Sequence::value_type t;
+ typename Sequence::size_type n;
+ typename Sequence::value_type* first, *last;
+ typename Sequence::iterator p, q;
+ };
+
+ template
+ struct FrontInsertionSequenceConcept
+ {
+ void constraints() {
+ function_requires< SequenceConcept >();
+
+ c.push_front(t);
+ c.pop_front();
+ }
+ FrontInsertionSequence c;
+ typename FrontInsertionSequence::value_type t;
+ };
+
+ template
+ struct BackInsertionSequenceConcept
+ {
+ typedef typename BackInsertionSequence::reference reference;
+ typedef typename BackInsertionSequence::const_reference const_reference;
+
+ void constraints() {
+ function_requires< SequenceConcept >();
+
+ c.push_back(t);
+ c.pop_back();
+ reference r = c.back();
+ ignore_unused_variable_warning(r);
+ }
+ void const_constraints(const BackInsertionSequence& c) {
+ const_reference r = c.back();
+ ignore_unused_variable_warning(r);
+ };
+ BackInsertionSequence c;
+ typename BackInsertionSequence::value_type t;
+ };
+
+ template
+ struct AssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< ForwardContainerConcept >();
+ function_requires< DefaultConstructibleConcept >();
+
+ i = c.find(k);
+ r = c.equal_range(k);
+ c.erase(k);
+ c.erase(i);
+ c.erase(r.first, r.second);
+ const_constraints(c);
+ }
+ void const_constraints(const AssociativeContainer& c) {
+ ci = c.find(k);
+ n = c.count(k);
+ cr = c.equal_range(k);
+ }
+ typedef typename AssociativeContainer::iterator iterator;
+ typedef typename AssociativeContainer::const_iterator const_iterator;
+
+ AssociativeContainer c;
+ iterator i;
+ std::pair r;
+ const_iterator ci;
+ std::pair cr;
+ typename AssociativeContainer::key_type k;
+ typename AssociativeContainer::size_type n;
+ };
+
+ template
+ struct UniqueAssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< AssociativeContainerConcept >();
+
+ UniqueAssociativeContainer c(first, last);
+
+ pos_flag = c.insert(t);
+ c.insert(first, last);
+
+ ignore_unused_variable_warning(c);
+ }
+ std::pair pos_flag;
+ typename UniqueAssociativeContainer::value_type t;
+ typename UniqueAssociativeContainer::value_type* first, *last;
+ };
+
+ template
+ struct MultipleAssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< AssociativeContainerConcept >();
+
+ MultipleAssociativeContainer c(first, last);
+
+ pos = c.insert(t);
+ c.insert(first, last);
+
+ ignore_unused_variable_warning(c);
+ ignore_unused_variable_warning(pos);
+ }
+ typename MultipleAssociativeContainer::iterator pos;
+ typename MultipleAssociativeContainer::value_type t;
+ typename MultipleAssociativeContainer::value_type* first, *last;
+ };
+
+ template
+ struct SimpleAssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< AssociativeContainerConcept >();
+ typedef typename SimpleAssociativeContainer::key_type key_type;
+ typedef typename SimpleAssociativeContainer::value_type value_type;
+ typedef typename require_same::type req;
+ }
+ };
+
+ template
+ struct PairAssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< AssociativeContainerConcept >();
+ typedef typename SimpleAssociativeContainer::key_type key_type;
+ typedef typename SimpleAssociativeContainer::value_type value_type;
+ typedef typename SimpleAssociativeContainer::mapped_type mapped_type;
+ typedef std::pair required_value_type;
+ typedef typename require_same::type req;
+ }
+ };
+
+ template
+ struct SortedAssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< AssociativeContainerConcept >();
+ function_requires< ReversibleContainerConcept >();
+
+ SortedAssociativeContainer
+ c(kc),
+ c2(first, last),
+ c3(first, last, kc);
+
+ p = c.upper_bound(k);
+ p = c.lower_bound(k);
+ r = c.equal_range(k);
+
+ c.insert(p, t);
+
+ ignore_unused_variable_warning(c);
+ ignore_unused_variable_warning(c2);
+ ignore_unused_variable_warning(c3);
+ }
+ void const_constraints(const SortedAssociativeContainer& c) {
+ kc = c.key_comp();
+ vc = c.value_comp();
+
+ cp = c.upper_bound(k);
+ cp = c.lower_bound(k);
+ cr = c.equal_range(k);
+ }
+ typename SortedAssociativeContainer::key_compare kc;
+ typename SortedAssociativeContainer::value_compare vc;
+ typename SortedAssociativeContainer::value_type t;
+ typename SortedAssociativeContainer::key_type k;
+ typedef typename SortedAssociativeContainer::iterator iterator;
+ typedef typename SortedAssociativeContainer::const_iterator const_iterator;
+ iterator p;
+ const_iterator cp;
+ std::pair r;
+ std::pair cr;
+ typename SortedAssociativeContainer::value_type* first, *last;
+ };
+
+ // HashedAssociativeContainer
+
+} // namespace boost
+
+#endif // BOOST_CONCEPT_CHECKS_HPP
+
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 2a007f93639..84a9ebcf571 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -63,9 +63,8 @@
# define __STL_UITHREADS
#endif
-// Concept-checking code is off by default unless users define
-// the _STL_USE_CONCEPT_CHECKS hook.
-//#define _STL_USE_CONCEPT_CHECKS 1
+// Concept-checking hooks and related config are now in bits/concept_check.h.
+
// This is also a user hook, but via -f[no-]exceptions, not direct #defines.
#ifdef __EXCEPTIONS
@@ -85,7 +84,8 @@
# define __STL_UNWIND(action)
#endif
-// This is the "underlying allocator"
+// This is the "underlying allocator" for STL. The alternatives are
+// homegrown schemes involving a kind of mutex and free list; see stl_alloc.h.
#define __USE_MALLOC
// Define this to permit user-level control of the expansion of string
@@ -105,11 +105,6 @@
//# define __STL_LONG_LONG
//#endif
-// 20010302 pme -- this is only used in bits/concept_checks.h
-//#if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
-# define __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
-//#endif
-
// Mingw32, GCC compiler using the Microsoft C runtime (settings taken from
// SGI's stl_config.h)
#if defined(__MINGW32__)
diff --git a/libstdc++-v3/include/bits/concept_check.h b/libstdc++-v3/include/bits/concept_check.h
new file mode 100644
index 00000000000..28886a9eb0a
--- /dev/null
+++ b/libstdc++-v3/include/bits/concept_check.h
@@ -0,0 +1,93 @@
+// Concept-checking control -*- C++ -*-
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _GLIBCPP_CONCEPT_CHECK
+#define _GLIBCPP_CONCEPT_CHECK 1
+
+#pragma GCC system_header
+#include
+
+
+// Concept-checking code is on by default unless users turn it off via any
+// of these methods:
+// - _GLIBCPP_NO_CONCEPT_CHECKS is a user hook; defining it disables the
+// checks.
+// - _STL_NO_CONCEPT_CHECKS is a user hook from the old STL implementation
+// specifically for this purpose; defining it disables the checks, in
+// case the user is expecting the old version.
+// - NDEBUG is the usual macro that kills assert(). Defining it will also
+// disable the checks, by the reasoning that if the user doesn't want
+// any runtime assertion code, then no space penalty for the checks
+// is desired either.
+
+// All places in libstdc++-v3 where these are used, or /might/ be used, or
+// don't need to be used, or perhaps /should/ be used, are commented with
+// "concept requirements" (and maybe some more text). So grep like crazy
+// if you're looking for additional places to use these.
+
+
+#if defined(_GLIBCPP_NO_CONCEPT_CHECKS) || defined(_STL_NO_CONCEPT_CHECKS) \
+ || defined(NDEBUG)
+
+#define glibcpp_function_requires(...)
+#define glibcpp_class_requires(a,b)
+#define glibcpp_class_requires2(a,b,c)
+#define glibcpp_class_requires3(a,b,c,d)
+#define glibcpp_class_requires4(a,b,c,d,e)
+
+#else // the checks are on
+
+#include
+
+// Note that the obvious and elegant approach of
+//
+//#define glibcpp_function_requires(C) \
+// boost::function_requires< boost::C >()
+//
+// won't work due to concept templates with more than one parameter, e.g.,
+// BinaryPredicateConcept. The preprocessor tries to split things up on
+// the commas in the template argument list. We can't use an inner pair of
+// parenthesis to hide the commas, because "boost::(Temp)" isn't
+// a valid instantiation pattern.
+
+#define glibcpp_function_requires(...) \
+ boost::function_requires< boost::__VA_ARGS__ >()
+#define glibcpp_class_requires(a,C) \
+ BOOST_CLASS_REQUIRES(a, boost, C)
+#define glibcpp_class_requires2(a,b,C) \
+ BOOST_CLASS_REQUIRES2(a, b, boost, C)
+#define glibcpp_class_requires3(a,b,c,C) \
+ BOOST_CLASS_REQUIRES3(a, b, c, boost, C)
+#define glibcpp_class_requires4(a,b,c,d,C) \
+ BOOST_CLASS_REQUIRES4(a, b, c, d, boost, C)
+
+#endif // enable/disable
+
+#endif // _GLIBCPP_CONCEPT_CHECK
+
diff --git a/libstdc++-v3/include/bits/concept_checks.h b/libstdc++-v3/include/bits/concept_checks.h
deleted file mode 100644
index aa77d9af063..00000000000
--- a/libstdc++-v3/include/bits/concept_checks.h
+++ /dev/null
@@ -1,811 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __CONCEPT_CHECKS_H
-#define __CONCEPT_CHECKS_H
-
-/*
- Use these macro like assertions, but they assert properties
- on types (usually template arguments). In technical terms they
- verify whether a type "models" a "concept".
-
- This set of requirements and the terminology used here is derived
- from the book "Generic Programming and the STL" by Matt Austern
- (Addison Wesley). For further information please consult that
- book. The requirements also are intended to match the ANSI/ISO C++
- standard.
-
- This file covers the basic concepts and the iterator concepts.
- There are several other files that provide the requirements
- for the STL containers:
- container_concepts.h
- sequence_concepts.h
- assoc_container_concepts.h
-
- Jeremy Siek, 1999
-
- TO DO:
- - some issues with regards to concept classification and mutability
- including AssociativeContianer -> ForwardContainer
- and SortedAssociativeContainer -> ReversibleContainer
- - HashedAssociativeContainer
- - Allocator
- - Function Object Concepts
-
- */
-
-#ifndef __STL_USE_CONCEPT_CHECKS
-
-// Some compilers lack the features that are necessary for concept checks.
-// On those compilers we define the concept check macros to do nothing.
-#define __STL_REQUIRES(__type_var, __concept) do {} while(0)
-#define __STL_CLASS_REQUIRES(__type_var, __concept) \
- static int __##__type_var##_##__concept
-#define __STL_CONVERTIBLE(__type_x, __type_y) do {} while(0)
-#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0)
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
- static int __##__type_x##__type_y##_require_same_type
-#define __STL_GENERATOR_CHECK(__func, __ret) do {} while(0)
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
- static int __##__func##__ret##_generator_check
-#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0)
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
- static int __##__func##__ret##__arg##_unary_function_check
-#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- do {} while(0)
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- static int __##__func##__ret##__first##__second##_binary_function_check
-#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- do {} while(0)
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- static int __##__opname##__ret##__first##__second##_require_binary_op
-
-#else /* __STL_USE_CONCEPT_CHECKS */
-
-// This macro tests whether the template argument "__type_var"
-// satisfies the requirements of "__concept". Here is a list of concepts
-// that we know how to check:
-// _Allocator
-// _Assignable
-// _DefaultConstructible
-// _EqualityComparable
-// _LessThanComparable
-// _TrivialIterator
-// _InputIterator
-// _OutputIterator
-// _ForwardIterator
-// _BidirectionalIterator
-// _RandomAccessIterator
-// _Mutable_TrivialIterator
-// _Mutable_ForwardIterator
-// _Mutable_BidirectionalIterator
-// _Mutable_RandomAccessIterator
-
-#define __STL_REQUIRES(__type_var, __concept) \
-do { \
- void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\
- ::__concept##_requirement_violation; __x = __x; } while (0)
-
-// Use this to check whether type X is convertible to type Y
-#define __STL_CONVERTIBLE(__type_x, __type_y) \
-do { \
- void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \
- __type_y >::__type_X_is_not_convertible_to_type_Y; \
- __x = __x; } while (0)
-
-// Use this to test whether two template arguments are the same type
-#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) \
-do { \
- void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \
- __type_y >::__type_X_not_same_as_type_Y; \
- __x = __x; } while (0)
-
-
-// function object checks
-#define __STL_GENERATOR_CHECK(__func, __ret) \
-do { \
- __ret (*__x)( __func&) = \
- _STL_GENERATOR_ERROR< \
- __func, __ret>::__generator_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
-do { \
- __ret (*__x)( __func&, const __arg& ) = \
- _STL_UNARY_FUNCTION_ERROR< \
- __func, __ret, __arg>::__unary_function_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
-do { \
- __ret (*__x)( __func&, const __first&, const __second& ) = \
- _STL_BINARY_FUNCTION_ERROR< \
- __func, __ret, __first, __second>::__binary_function_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- do { \
- __ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \
- __ret, __first, __second>::__binary_operator_requirement_violation; \
- __ret (*__y)( const __first&, const __second& ) = \
- _STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \
- __const_binary_operator_requirement_violation; \
- __y = __y; __x = __x; } while (0)
-
-
-#ifdef __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
-
-#define __STL_CLASS_REQUIRES(__type_var, __concept)
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y)
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret)
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg)
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second)
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second)
-
-#else
-
-// Use this macro inside of template classes, where you would
-// like to place requirements on the template arguments to the class
-// Warning: do not pass pointers and such (e.g. T*) in as the __type_var,
-// since the type_var is used to construct identifiers. Instead typedef
-// the pointer type, then use the typedef name for the __type_var.
-#define __STL_CLASS_REQUIRES(__type_var, __concept) \
- typedef void (* __func##__type_var##__concept)( __type_var ); \
- template <__func##__type_var##__concept _Tp1> \
- struct __dummy_struct_##__type_var##__concept { }; \
- static __dummy_struct_##__type_var##__concept< \
- __concept##_concept_specification< \
- __type_var>::__concept##_requirement_violation> \
- __dummy_ptr_##__type_var##__concept
-
-
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
- typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \
- __type_y ); \
- template < __func_##__type_x##__type_y##same_type _Tp1> \
- struct __dummy_struct_##__type_x##__type_y##_same_type { }; \
- static __dummy_struct_##__type_x##__type_y##_same_type< \
- _STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y> \
- __dummy_ptr_##__type_x##__type_y##_same_type
-
-
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
- typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \
- template <__f_##__func##__ret##_generator _Tp1> \
- struct __dummy_struct_##__func##__ret##_generator { }; \
- static __dummy_struct_##__func##__ret##_generator< \
- _STL_GENERATOR_ERROR< \
- __func, __ret>::__generator_requirement_violation> \
- __dummy_ptr_##__func##__ret##_generator
-
-
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
- typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \
- const __arg& ); \
- template <__f_##__func##__ret##__arg##_unary_check _Tp1> \
- struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \
- static __dummy_struct_##__func##__ret##__arg##_unary_check< \
- _STL_UNARY_FUNCTION_ERROR< \
- __func, __ret, __arg>::__unary_function_requirement_violation> \
- __dummy_ptr_##__func##__ret##__arg##_unary_check
-
-
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\
- const __second& ); \
- template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \
- struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \
- static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \
- _STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \
- __binary_function_requirement_violation> \
- __dummy_ptr_##__func##__ret##__first##__second##_binary_check
-
-
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \
- const __second& ); \
- template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \
- struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \
- static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \
- _STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \
- __binary_operator_requirement_violation> \
- __dummy_ptr_##__func##__ret##__first##__second##_binary_op
-
-#endif
-
-/* helper class for finding non-const version of a type. Need to have
- something to assign to etc. when testing constant iterators. */
-
-template
-struct _Mutable_trait {
- typedef _Tp _Type;
-};
-template
-struct _Mutable_trait {
- typedef _Tp _Type;
-};
-
-
-/* helper function for avoiding compiler warnings about unused variables */
-template
-void __sink_unused_warning(_Type) { }
-
-template
-struct _STL_CONVERT_ERROR {
- static void
- __type_X_is_not_convertible_to_type_Y(_TypeX __x, _TypeY) {
- _TypeY __y = __x;
- __sink_unused_warning(__y);
- }
-};
-
-
-template struct __check_equal { };
-
-template
-struct _STL_SAME_TYPE_ERROR {
- static void
- __type_X_not_same_as_type_Y(_TypeX , _TypeY ) {
- __check_equal<_TypeX> t1 = __check_equal<_TypeY>();
- }
-};
-
-
-// Some Functon Object Checks
-
-template
-struct _STL_GENERATOR_ERROR {
- static _Ret __generator_requirement_violation(_Func& __f) {
- return __f();
- }
-};
-
-template
-struct _STL_GENERATOR_ERROR<_Func, void> {
- static void __generator_requirement_violation(_Func& __f) {
- __f();
- }
-};
-
-
-template
-struct _STL_UNARY_FUNCTION_ERROR {
- static _Ret
- __unary_function_requirement_violation(_Func& __f,
- const _Arg& __arg) {
- return __f(__arg);
- }
-};
-
-template
-struct _STL_UNARY_FUNCTION_ERROR<_Func, void, _Arg> {
- static void
- __unary_function_requirement_violation(_Func& __f,
- const _Arg& __arg) {
- __f(__arg);
- }
-};
-
-template
-struct _STL_BINARY_FUNCTION_ERROR {
- static _Ret
- __binary_function_requirement_violation(_Func& __f,
- const _First& __first,
- const _Second& __second) {
- return __f(__first, __second);
- }
-};
-
-template
-struct _STL_BINARY_FUNCTION_ERROR<_Func, void, _First, _Second> {
- static void
- __binary_function_requirement_violation(_Func& __f,
- const _First& __first,
- const _Second& __second) {
- __f(__first, __second);
- }
-};
-
-
-#define __STL_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \
-template \
-struct _STL_BINARY##_NAME##_ERROR { \
- static _Ret \
- __const_binary_operator_requirement_violation(const _First& __first, \
- const _Second& __second) { \
- return __first _OP __second; \
- } \
- static _Ret \
- __binary_operator_requirement_violation(_First& __first, \
- _Second& __second) { \
- return __first _OP __second; \
- } \
-}
-
-__STL_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN);
-__STL_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN);
-__STL_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS);
-__STL_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES);
-__STL_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE);
-__STL_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT);
-__STL_DEFINE_BINARY_OP_CHECK(%, _OP_MOD);
-// ...
-
-// TODO, add unary operators (prefix and postfix)
-
-/*
- The presence of this class is just to trick EDG into displaying
- these error messages before any other errors. Without the
- classes, the errors in the functions get reported after
- other class errors deep inside the library. The name
- choice just makes for an eye catching error message :)
- */
-struct _STL_ERROR {
-
- template
- static _Type
- __default_constructor_requirement_violation(_Type) {
- return _Type();
- }
- template
- static _Type
- __assignment_operator_requirement_violation(_Type __a) {
- __a = __a;
- return __a;
- }
- template
- static _Type
- __copy_constructor_requirement_violation(_Type __a) {
- _Type __c(__a);
- return __c;
- }
- template
- static _Type
- __const_parameter_required_for_copy_constructor(_Type /* __a */,
- const _Type& __b) {
- _Type __c(__b);
- return __c;
- }
- template
- static _Type
- __const_parameter_required_for_assignment_operator(_Type __a,
- const _Type& __b) {
- __a = __b;
- return __a;
- }
- template
- static _Type
- __less_than_comparable_requirement_violation(_Type __a, _Type __b) {
- if (__a < __b) return __a;
- return __b;
- }
- template
- static _Type
- __equality_comparable_requirement_violation(_Type __a, _Type __b) {
- if (__a == __b || __a != __b) return __a;
- return __b;
- }
- template
- static void
- __dereference_operator_requirement_violation(_Iterator __i) {
- __sink_unused_warning(*__i);
- }
- template
- static void
- __dereference_operator_and_assignment_requirement_violation(_Iterator __i) {
- *__i = *__i;
- }
- template
- static void
- __preincrement_operator_requirement_violation(_Iterator __i) {
- ++__i;
- }
- template
- static void
- __postincrement_operator_requirement_violation(_Iterator __i) {
- __i++;
- }
- template
- static void
- __predecrement_operator_requirement_violation(_Iterator __i) {
- --__i;
- }
- template
- static void
- __postdecrement_operator_requirement_violation(_Iterator __i) {
- __i--;
- }
- template
- static void
- __postincrement_operator_and_assignment_requirement_violation(_Iterator __i,
- _Type __t) {
- *__i++ = __t;
- }
- template
- static _Iterator
- __iterator_addition_assignment_requirement_violation(_Iterator __i,
- _Distance __n) {
- __i += __n;
- return __i;
- }
- template
- static _Iterator
- __iterator_addition_requirement_violation(_Iterator __i, _Distance __n) {
- __i = __i + __n;
- __i = __n + __i;
- return __i;
- }
- template
- static _Iterator
- __iterator_subtraction_assignment_requirement_violation(_Iterator __i,
- _Distance __n) {
- __i -= __n;
- return __i;
- }
- template
- static _Iterator
- __iterator_subtraction_requirement_violation(_Iterator __i, _Distance __n) {
- __i = __i - __n;
- return __i;
- }
- template
- static _Distance
- __difference_operator_requirement_violation(_Iterator __i, _Iterator __j,
- _Distance __n) {
- __n = __i - __j;
- return __n;
- }
- template
- static _Type
- __element_access_operator_requirement_violation(_Exp __x, _Type*,
- _Distance __n) {
- return __x[__n];
- }
- template
- static void
- __element_assignment_operator_requirement_violation(_Exp __x,
- _Type* __t,
- _Distance __n) {
- __x[__n] = *__t;
- }
-
-}; /* _STL_ERROR */
-
-/* Associated Type Requirements */
-
-namespace std
-{
-template struct iterator_traits;
-} // namespace std
-
-template
-struct __value_type_type_definition_requirement_violation {
- typedef typename std::iterator_traits<_Iter>::value_type value_type;
-};
-
-template
-struct __difference_type_type_definition_requirement_violation {
- typedef typename std::iterator_traits<_Iter>::difference_type
- difference_type;
-};
-
-template
-struct __reference_type_definition_requirement_violation {
- typedef typename std::iterator_traits<_Iter>::reference reference;
-};
-
-template
-struct __pointer_type_definition_requirement_violation {
- typedef typename std::iterator_traits<_Iter>::pointer pointer;
-};
-
-template
-struct __iterator_category_type_definition_requirement_violation {
- typedef typename std::iterator_traits<_Iter>::iterator_category
- iterator_category;
-};
-
-/* Assignable Requirements */
-
-
-template
-struct _Assignable_concept_specification {
- static void _Assignable_requirement_violation(_Type __a) {
- _STL_ERROR::__assignment_operator_requirement_violation(__a);
- _STL_ERROR::__copy_constructor_requirement_violation(__a);
- _STL_ERROR::__const_parameter_required_for_copy_constructor(__a,__a);
- _STL_ERROR::__const_parameter_required_for_assignment_operator(__a,__a);
- }
-};
-
-/* DefaultConstructible Requirements */
-
-
-template
-struct _DefaultConstructible_concept_specification {
- static void _DefaultConstructible_requirement_violation(_Type __a) {
- _STL_ERROR::__default_constructor_requirement_violation(__a);
- }
-};
-
-/* EqualityComparable Requirements */
-
-template
-struct _EqualityComparable_concept_specification {
- static void _EqualityComparable_requirement_violation(_Type __a) {
- _STL_ERROR::__equality_comparable_requirement_violation(__a, __a);
- }
-};
-
-/* LessThanComparable Requirements */
-template
-struct _LessThanComparable_concept_specification {
- static void _LessThanComparable_requirement_violation(_Type __a) {
- _STL_ERROR::__less_than_comparable_requirement_violation(__a, __a);
- }
-};
-
-/* TrivialIterator Requirements */
-
-template
-struct _TrivialIterator_concept_specification {
-static void
-_TrivialIterator_requirement_violation(_TrivialIterator __i) {
- typedef typename
- __value_type_type_definition_requirement_violation<_TrivialIterator>::
- value_type __T;
- // Refinement of Assignable
- _Assignable_concept_specification<_TrivialIterator>::
- _Assignable_requirement_violation(__i);
- // Refinement of DefaultConstructible
- _DefaultConstructible_concept_specification<_TrivialIterator>::
- _DefaultConstructible_requirement_violation(__i);
- // Refinement of EqualityComparable
- _EqualityComparable_concept_specification<_TrivialIterator>::
- _EqualityComparable_requirement_violation(__i);
- // Valid Expressions
- _STL_ERROR::__dereference_operator_requirement_violation(__i);
-}
-};
-
-template
-struct _Mutable_TrivialIterator_concept_specification {
-static void
-_Mutable_TrivialIterator_requirement_violation(_TrivialIterator __i) {
- _TrivialIterator_concept_specification<_TrivialIterator>::
- _TrivialIterator_requirement_violation(__i);
- // Valid Expressions
- _STL_ERROR::__dereference_operator_and_assignment_requirement_violation(__i);
-}
-};
-
-/* InputIterator Requirements */
-
-template
-struct _InputIterator_concept_specification {
-static void
-_InputIterator_requirement_violation(_InputIterator __i) {
- // Refinement of TrivialIterator
- _TrivialIterator_concept_specification<_InputIterator>::
- _TrivialIterator_requirement_violation(__i);
- // Associated Types
- __difference_type_type_definition_requirement_violation<_InputIterator>();
- __reference_type_definition_requirement_violation<_InputIterator>();
- __pointer_type_definition_requirement_violation<_InputIterator>();
- __iterator_category_type_definition_requirement_violation<_InputIterator>();
- // Valid Expressions
- _STL_ERROR::__preincrement_operator_requirement_violation(__i);
- _STL_ERROR::__postincrement_operator_requirement_violation(__i);
-}
-};
-
-/* OutputIterator Requirements */
-
-template
-struct _OutputIterator_concept_specification {
-static void
-_OutputIterator_requirement_violation(_OutputIterator __i) {
- // Refinement of Assignable
- _Assignable_concept_specification<_OutputIterator>::
- _Assignable_requirement_violation(__i);
- // Associated Types
- __iterator_category_type_definition_requirement_violation<_OutputIterator>();
- // Valid Expressions
- _STL_ERROR::__dereference_operator_requirement_violation(__i);
- _STL_ERROR::__preincrement_operator_requirement_violation(__i);
- _STL_ERROR::__postincrement_operator_requirement_violation(__i);
- _STL_ERROR::
- __postincrement_operator_and_assignment_requirement_violation(__i, *__i);
-}
-};
-
-/* ForwardIterator Requirements */
-
-template
-struct _ForwardIterator_concept_specification {
-static void
-_ForwardIterator_requirement_violation(_ForwardIterator __i) {
- // Refinement of InputIterator
- _InputIterator_concept_specification<_ForwardIterator>::
- _InputIterator_requirement_violation(__i);
-}
-};
-
-template
-struct _Mutable_ForwardIterator_concept_specification {
-static void
-_Mutable_ForwardIterator_requirement_violation(_ForwardIterator __i) {
- _ForwardIterator_concept_specification<_ForwardIterator>::
- _ForwardIterator_requirement_violation(__i);
- // Refinement of OutputIterator
- _OutputIterator_concept_specification<_ForwardIterator>::
- _OutputIterator_requirement_violation(__i);
-}
-};
-
-/* BidirectionalIterator Requirements */
-
-template
-struct _BidirectionalIterator_concept_specification {
-static void
-_BidirectionalIterator_requirement_violation(_BidirectionalIterator __i) {
- // Refinement of ForwardIterator
- _ForwardIterator_concept_specification<_BidirectionalIterator>::
- _ForwardIterator_requirement_violation(__i);
- // Valid Expressions
- _STL_ERROR::__predecrement_operator_requirement_violation(__i);
- _STL_ERROR::__postdecrement_operator_requirement_violation(__i);
-}
-};
-
-template
-struct _Mutable_BidirectionalIterator_concept_specification {
-static void
-_Mutable_BidirectionalIterator_requirement_violation(
- _BidirectionalIterator __i)
-{
- _BidirectionalIterator_concept_specification<_BidirectionalIterator>::
- _BidirectionalIterator_requirement_violation(__i);
- // Refinement of mutable_ForwardIterator
- _Mutable_ForwardIterator_concept_specification<_BidirectionalIterator>::
- _Mutable_ForwardIterator_requirement_violation(__i);
- typedef typename
- __value_type_type_definition_requirement_violation<
- _BidirectionalIterator>::value_type __T;
- typename _Mutable_trait<__T>::_Type* __tmp_ptr = 0;
- // Valid Expressions
- _STL_ERROR::
- __postincrement_operator_and_assignment_requirement_violation(__i,
- *__tmp_ptr);
-}
-};
-
-/* RandomAccessIterator Requirements */
-
-template
-struct _RandomAccessIterator_concept_specification {
-static void
-_RandomAccessIterator_requirement_violation(_RandAccIter __i) {
- // Refinement of BidirectionalIterator
- _BidirectionalIterator_concept_specification<_RandAccIter>::
- _BidirectionalIterator_requirement_violation(__i);
- // Refinement of LessThanComparable
- _LessThanComparable_concept_specification<_RandAccIter>::
- _LessThanComparable_requirement_violation(__i);
- typedef typename
- __value_type_type_definition_requirement_violation<_RandAccIter>
- ::value_type
- value_type;
- typedef typename
- __difference_type_type_definition_requirement_violation<_RandAccIter>
- ::difference_type
- _Dist;
- typedef typename _Mutable_trait<_Dist>::_Type _MutDist;
-
- // Valid Expressions
- _STL_ERROR::__iterator_addition_assignment_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::__iterator_addition_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::
- __iterator_subtraction_assignment_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::__iterator_subtraction_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::__difference_operator_requirement_violation(__i, __i,
- _MutDist());
- typename _Mutable_trait::_Type* __dummy_ptr = 0;
- _STL_ERROR::__element_access_operator_requirement_violation(__i,
- __dummy_ptr,
- _MutDist());
-}
-};
-
-template
-struct _Mutable_RandomAccessIterator_concept_specification {
-static void
-_Mutable_RandomAccessIterator_requirement_violation(_RandAccIter __i)
-{
- _RandomAccessIterator_concept_specification<_RandAccIter>::
- _RandomAccessIterator_requirement_violation(__i);
- // Refinement of mutable_BidirectionalIterator
- _Mutable_BidirectionalIterator_concept_specification<_RandAccIter>::
- _Mutable_BidirectionalIterator_requirement_violation(__i);
- typedef typename
- __value_type_type_definition_requirement_violation<_RandAccIter>
- ::value_type
- value_type;
- typedef typename
- __difference_type_type_definition_requirement_violation<_RandAccIter>
- ::difference_type
- _Dist;
-
- typename _Mutable_trait::_Type* __tmp_ptr = 0;
- // Valid Expressions
- _STL_ERROR::__element_assignment_operator_requirement_violation(__i,
- __tmp_ptr, _Dist());
-}
-};
-
-#define __STL_TYPEDEF_REQUIREMENT(__REQUIREMENT) \
-template \
-struct __##__REQUIREMENT##__typedef_requirement_violation { \
- typedef typename Type::__REQUIREMENT __REQUIREMENT; \
-}
-
-__STL_TYPEDEF_REQUIREMENT(value_type);
-__STL_TYPEDEF_REQUIREMENT(difference_type);
-__STL_TYPEDEF_REQUIREMENT(size_type);
-__STL_TYPEDEF_REQUIREMENT(reference);
-__STL_TYPEDEF_REQUIREMENT(const_reference);
-__STL_TYPEDEF_REQUIREMENT(pointer);
-__STL_TYPEDEF_REQUIREMENT(const_pointer);
-
-
-template
-struct _Allocator_concept_specification {
-static void
-_Allocator_requirement_violation(_Alloc __a) {
- // Refinement of DefaultConstructible
- _DefaultConstructible_concept_specification<_Alloc>::
- _DefaultConstructible_requirement_violation(__a);
- // Refinement of EqualityComparable
- _EqualityComparable_concept_specification<_Alloc>::
- _EqualityComparable_requirement_violation(__a);
- // Associated Types
- __value_type__typedef_requirement_violation<_Alloc>();
- __difference_type__typedef_requirement_violation<_Alloc>();
- __size_type__typedef_requirement_violation<_Alloc>();
- __reference__typedef_requirement_violation<_Alloc>();
- __const_reference__typedef_requirement_violation<_Alloc>();
- __pointer__typedef_requirement_violation<_Alloc>();
- __const_pointer__typedef_requirement_violation<_Alloc>();
- typedef typename _Alloc::value_type _Tp;
-// __STL_REQUIRES_SAME_TYPE(typename _Alloc::template rebind<_Tp>::other, _Alloc);
-}
-};
-
-#endif /* __STL_USE_CONCEPT_CHECKS */
-
-#endif /* __CONCEPT_CHECKS_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/libstdc++-v3/include/bits/container_concepts.h b/libstdc++-v3/include/bits/container_concepts.h
deleted file mode 100644
index 99aec1c4b62..00000000000
--- a/libstdc++-v3/include/bits/container_concepts.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __STL_CONTAINER_CONCEPTS_H
-#define __STL_CONTAINER_CONCEPTS_H
-
-
-#include
-
-#ifdef __STL_USE_CONCEPT_CHECKS
-
-
-// This file covers the following concepts:
-// _Container
-// _ForwardContainer
-// _ReversibleContainer
-// _const_ReversibleContainer
-// _RandomAccessContainer
-//
-
-struct _ERROR_IN_STL_CONTAINER {
-
- /* Container expresssions */
-
- template
- static void
- __begin_iterator_accessor_requirement_violation(_Container __c) {
- __c.begin();
- }
- template
- static void
- __const_begin_iterator_accessor_requirement_violation(const _Container& __c) {
- __c.begin();
- }
- template
- static void
- __end_iterator_accessor_requirement_violation(_Container __c) {
- __c.end();
- }
- template
- static void
- __const_end_iterator_accessor_requirement_violation(const _Container& __c) {
- __c.end();
- }
-
- template
- static void
- __rbegin_iterator_accessor_requirement_violation(_Container __c) {
- __c.rbegin();
- }
- template
- static void
- __const_rbegin_iterator_accessor_requirement_violation(const _Container& __c) {
- __c.rbegin();
- }
- template
- static void
- __rend_iterator_accessor_requirement_violation(_Container __c) {
- __c.rend();
- }
- template
- static void
- __const_rend_iterator_accessor_requirement_violation(const _Container& __c) {
- __c.rend();
- }
- template
- static void
- __size_function_must_be_const(const _Container& __c) {
- __c.size();
- }
- template
- static void
- __size_function_requirement_violation(_Container& __c) {
- __c.size();
- __size_function_must_be_const(__c);
- }
- template
- static void
- __max_size_function_must_be_const(const _Container& __c) {
- __c.max_size();
- }
- template
- static void
- __max_size_function_requirement_violation(_Container& __c) {
- __c.max_size();
- __max_size_function_must_be_const(__c);
- }
- template
- static void
- __empty_function_must_be_const(const _Container& __c) {
- __c.empty();
- }
- template
- static void
- __empty_function_requirement_violation(_Container& __c) {
- __c.empty();
- __empty_function_must_be_const(__c);
- }
- template
- static void
- __swap_function_requirement_violation(_Container& __c) {
- __c.swap(__c);
- }
-
-};
-
-
-__STL_TYPEDEF_REQUIREMENT(iterator);
-__STL_TYPEDEF_REQUIREMENT(const_iterator);
-
-/* Containers */
-
-template
-struct _Container_concept_specification {
-static void
-_Container_requirement_violation(_Container __c) {
- // Refinement of Assignable
- _Assignable_concept_specification<_Container>::_Assignable_requirement_violation(__c);
- // Associated Types
- __value_type__typedef_requirement_violation<_Container>();
- __difference_type__typedef_requirement_violation<_Container>();
- __size_type__typedef_requirement_violation<_Container>();
- __reference__typedef_requirement_violation<_Container>();
- __const_reference__typedef_requirement_violation<_Container>();
- __pointer__typedef_requirement_violation<_Container>();
- __const_pointer__typedef_requirement_violation<_Container>();
- __iterator__typedef_requirement_violation<_Container>();
- __const_iterator__typedef_requirement_violation<_Container>();
- // Valid Expressions
- _ERROR_IN_STL_CONTAINER::__const_begin_iterator_accessor_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__const_end_iterator_accessor_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__begin_iterator_accessor_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__end_iterator_accessor_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__size_function_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__max_size_function_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__empty_function_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__swap_function_requirement_violation(__c);
- // Requirements on Iterators
- typedef typename _Container::iterator iter;
- typedef typename _Container::const_iterator const_iter;
- _InputIterator_concept_specification::_InputIterator_requirement_violation(const_iter());
- _InputIterator_concept_specification::_InputIterator_requirement_violation(iter());
-}
-};
-
-template
-struct _ForwardContainer_concept_specification {
-static void
-_ForwardContainer_requirement_violation(_ForwardContainer __c) {
- // Refinement of Container
- _Container_concept_specification<_ForwardContainer>::_Container_requirement_violation(__c);
- // Requirements on Iterators
- typedef typename _ForwardContainer::iterator iter;
- typedef typename _ForwardContainer::const_iterator const_iter;
- _ForwardIterator_concept_specification::_ForwardIterator_requirement_violation(const_iter());
- _Mutable_ForwardIterator_concept_specification::_Mutable_ForwardIterator_requirement_violation(iter());
-}
-};
-
-
-__STL_TYPEDEF_REQUIREMENT(reverse_iterator);
-__STL_TYPEDEF_REQUIREMENT(const_reverse_iterator);
-
-template
-struct _ReversibleContainer_concept_specification {
-static void
-_ReversibleContainer_requirement_violation(_ReversibleContainer __c) {
- // Refinement of ForwardContainer
- _ForwardContainer_concept_specification<_ReversibleContainer>::_ForwardContainer_requirement_violation(__c);
- // Associated types
- __reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
- __const_reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
- // Valid Expressions
- _ERROR_IN_STL_CONTAINER::__const_rbegin_iterator_accessor_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__const_rend_iterator_accessor_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__rbegin_iterator_accessor_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__rend_iterator_accessor_requirement_violation(__c);
- // Requirements on Iterators
- typedef typename _ReversibleContainer::iterator iter;
- typedef typename _ReversibleContainer::const_iterator const_iter;
- _BidirectionalIterator_concept_specification::_BidirectionalIterator_requirement_violation(const_iter());
- _Mutable_BidirectionalIterator_concept_specification::_Mutable_BidirectionalIterator_requirement_violation(iter());
-}
-};
-
-template
-struct _const_ReversibleContainer_concept_specification {
-static void
-_const_ReversibleContainer_requirement_violation(_ReversibleContainer __c) {
- // Refinement of Container (JGS, not ForwardContainer)
- _Container_concept_specification<_ReversibleContainer>::_Container_requirement_violation(__c);
- // Associated types
- __reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
- __const_reverse_iterator__typedef_requirement_violation<_ReversibleContainer>();
- // Valid Expressions
- _ERROR_IN_STL_CONTAINER::__const_rbegin_iterator_accessor_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__const_rend_iterator_accessor_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__rbegin_iterator_accessor_requirement_violation(__c);
- _ERROR_IN_STL_CONTAINER::__rend_iterator_accessor_requirement_violation(__c);
- // Requirements on Iterators
- typedef typename _ReversibleContainer::iterator iter;
- typedef typename _ReversibleContainer::const_iterator const_iter;
-
- _BidirectionalIterator_concept_specification::_BidirectionalIterator_requirement_violation(const_iter());
-}
-};
-
-
-template
-struct _RandomAccessContainer_concept_specification {
-static void
-_RandomAccessContainer_requirement_violation(_RandomAccessContainer __c) {
- // Refinement of ReversibleContainer
- _ReversibleContainer_concept_specification<_RandomAccessContainer>::_ReversibleContainer_requirement_violation(__c);
- // Valid Expressions
- typedef typename _RandomAccessContainer::value_type __T;
- typedef typename _RandomAccessContainer::difference_type _Dist;
- typedef typename _Mutable_trait<__T>::_Type Type;
- typedef Type* _TypePtr;
- typedef typename _Mutable_trait<_Dist>::_Type Dist;
- _STL_ERROR::__element_access_operator_requirement_violation(__c,
- _TypePtr(),
- Dist());
- // Requirements on Iterators
- typedef typename _RandomAccessContainer::iterator iter;
- typedef typename _RandomAccessContainer::const_iterator const_iter;
- _RandomAccessIterator_concept_specification::_RandomAccessIterator_requirement_violation(const_iter());
- _Mutable_RandomAccessIterator_concept_specification::_Mutable_RandomAccessIterator_requirement_violation(iter());
-}
-};
-
-#endif /* if __STL_USE_CONCEPT_CHECKS */
-
-#endif /* __STL_CONTAINER_CONCEPTS_H */
diff --git a/libstdc++-v3/include/bits/sbuf_iter.h b/libstdc++-v3/include/bits/sbuf_iter.h
index 2b2a1915eee..052b0dfbe85 100644
--- a/libstdc++-v3/include/bits/sbuf_iter.h
+++ b/libstdc++-v3/include/bits/sbuf_iter.h
@@ -39,7 +39,7 @@ namespace std
template