New concept checking implementation.

2001-04-02  Phil Edwards  <pme@sources.redhat.com>

	New concept checking implementation.
	* docs/html/19_diagnostics/howto.html:  Document.
	* docs/html/17_intro/concept_check.diff:  New file, for reference.
	* include/bits/boost_concept_check.h:  New file from Boost.
	* include/bits/c++config:  Update comments.

	* include/bits/concept_check.h:  New file.
	* include/bits/concept_checks.h:  Removed.
	* include/bits/container_concepts.h:  Removed.
	* include/bits/sequence_concepts.h:  Removed.
	* include/bits/stl_iterator_base.h:  Removed; split into...
	* include/bits/stl_iterator_base_funcs.h:  ...this new file...
	* include/bits/stl_iterator_base_types.h:  ...and this new file.

	* include/bits/sbuf_iter.h:  Update to use new implementation.
	* include/bits/std_iterator.h:  Likewise.
	* include/bits/std_memory.h:  Likewise.
	* include/bits/stl_algo.h:  Likewise.
	* include/bits/stl_algobase.h:  Likewise.
	* include/bits/stl_construct.h:  Likewise.
	* include/bits/stl_deque.h:  Likewise.
	* include/bits/stl_heap.h:  Likewise.
	* include/bits/stl_list.h:  Likewise.
	* include/bits/stl_map.h:  Likewise.
	* include/bits/stl_multimap.h:  Likewise.
	* include/bits/stl_multiset.h:  Likewise.
	* include/bits/stl_numeric.h:  Likewise.
	* include/bits/stl_queue.h:  Likewise.
	* include/bits/stl_set.h:  Likewise.
	* include/bits/stl_stack.h:  Likewise.
	* include/bits/stl_uninitialized.h:  Likewise.
	* include/bits/stl_vector.h:  Likewise.
	* include/ext/hash_map:  Likewise.
	* include/ext/hash_set:  Likewise.
	* include/ext/slist:  Likewise.
	* include/ext/stl_hashtable.h:  Likewise.

	* src/Makefile.am (base_headers):  Update list of headers.
	* Makefile.in:  Regenerated.
	* src/Makefile.in:  Regenerated.
	* libio/Makefile.in:  Regenerated.
	* libmath/Makefile.in:  Regenerated.
	* libsupc++/Makefile.in:  Regenerated.
	* testsuite/Makefile.in:  Regenerated.

	* docs/html/install.html:  Update contact information.
	* docs/html/17_intro/howto.html:  Ditto.
	* docs/html/18_support/howto.html:  Ditto.
	* docs/html/20_util/howto.html:  Ditto.
	* docs/html/21_strings/howto.html:  Ditto.
	* docs/html/22_locale/howto.html:  Ditto.
	* docs/html/23_containers/howto.html:  Ditto.
	* docs/html/24_iterators/howto.html:  Ditto.
	* docs/html/25_algorithms/howto.html:  Ditto.
	* docs/html/26_numerics/howto.html:  Ditto.
	* docs/html/27_io/howto.html:  Ditto.
	* docs/html/faq/index.html:  Ditto, plus info on new checking code.
	* docs/html/ext/howto.html:  Ditto, plus info on new checking code.
	* docs/html/faq/index.txt:  Regenerated.

From-SVN: r41031
This commit is contained in:
Phil Edwards 2001-04-03 00:26:58 +00:00
parent 9f4a318c36
commit 30a20a1ee0
54 changed files with 3220 additions and 2363 deletions

View file

@ -1,3 +1,65 @@
2001-04-02 Phil Edwards <pme@sources.redhat.com>
New concept checking implementation.
* docs/html/19_diagnostics/howto.html: Document.
* docs/html/17_intro/concept_check.diff: New file, for reference.
* include/bits/boost_concept_check.h: New file from Boost.
* include/bits/c++config: Update comments.
* include/bits/concept_check.h: New file.
* include/bits/concept_checks.h: Removed.
* include/bits/container_concepts.h: Removed.
* include/bits/sequence_concepts.h: Removed.
* include/bits/stl_iterator_base.h: Removed; split into...
* include/bits/stl_iterator_base_funcs.h: ...this new file...
* include/bits/stl_iterator_base_types.h: ...and this new file.
* include/bits/sbuf_iter.h: Update to use new implementation.
* include/bits/std_iterator.h: Likewise.
* include/bits/std_memory.h: Likewise.
* include/bits/stl_algo.h: Likewise.
* include/bits/stl_algobase.h: Likewise.
* include/bits/stl_construct.h: Likewise.
* include/bits/stl_deque.h: Likewise.
* include/bits/stl_heap.h: Likewise.
* include/bits/stl_list.h: Likewise.
* include/bits/stl_map.h: Likewise.
* include/bits/stl_multimap.h: Likewise.
* include/bits/stl_multiset.h: Likewise.
* include/bits/stl_numeric.h: Likewise.
* include/bits/stl_queue.h: Likewise.
* include/bits/stl_set.h: Likewise.
* include/bits/stl_stack.h: Likewise.
* include/bits/stl_uninitialized.h: Likewise.
* include/bits/stl_vector.h: Likewise.
* include/ext/hash_map: Likewise.
* include/ext/hash_set: Likewise.
* include/ext/slist: Likewise.
* include/ext/stl_hashtable.h: Likewise.
* src/Makefile.am (base_headers): Update list of headers.
* Makefile.in: Regenerated.
* src/Makefile.in: Regenerated.
* libio/Makefile.in: Regenerated.
* libmath/Makefile.in: Regenerated.
* libsupc++/Makefile.in: Regenerated.
* testsuite/Makefile.in: Regenerated.
* docs/html/install.html: Update contact information.
* docs/html/17_intro/howto.html: Ditto.
* docs/html/18_support/howto.html: Ditto.
* docs/html/20_util/howto.html: Ditto.
* docs/html/21_strings/howto.html: Ditto.
* docs/html/22_locale/howto.html: Ditto.
* docs/html/23_containers/howto.html: Ditto.
* docs/html/24_iterators/howto.html: Ditto.
* docs/html/25_algorithms/howto.html: Ditto.
* docs/html/26_numerics/howto.html: Ditto.
* docs/html/27_io/howto.html: Ditto.
* docs/html/faq/index.html: Ditto, plus info on new checking code.
* docs/html/ext/howto.html: Ditto, plus info on new checking code.
* docs/html/faq/index.txt: Regenerated.
2001-04-02 Zack Weinberg <zackw@stanford.edu> 2001-04-02 Zack Weinberg <zackw@stanford.edu>
* testsuite/lib/libstdc++.exp (dg-test): Annotate result * testsuite/lib/libstdc++.exp (dg-test): Annotate result

View file

@ -135,7 +135,48 @@ MULTICLEAN = true
# Work around what appears to be a GNU make bug handling MAKEFLAGS # Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and # values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile. # friends when we are called from the top level Makefile.
AM_MAKEFLAGS = "AR_FLAGS=$(AR_FLAGS)" "CC_FOR_BUILD=$(CC_FOR_BUILD)" "CC_FOR_TARGET=$(CC_FOR_TARGET)" "CFLAGS=$(CFLAGS)" "CXXFLAGS=$(CXXFLAGS)" "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" "INSTALL=$(INSTALL)" "INSTALL_DATA=$(INSTALL_DATA)" "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" "LDFLAGS=$(LDFLAGS)" "LIBCFLAGS=$(LIBCFLAGS)" "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" "MAKE=$(MAKE)" "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" "PICFLAG=$(PICFLAG)" "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" "SHELL=$(SHELL)" "EXPECT=$(EXPECT)" "RUNTEST=$(RUNTEST)" "RUNTESTFLAGS=$(RUNTESTFLAGS)" "exec_prefix=$(exec_prefix)" "infodir=$(infodir)" "libdir=$(libdir)" "includedir=$(includedir)" "prefix=$(prefix)" "tooldir=$(tooldir)" "AR=$(AR)" "AS=$(AS)" "CC=$(CC)" "CXX=$(CXX)" "LD=$(LD)" "LIBCFLAGS=$(LIBCFLAGS)" "PICFLAG=$(PICFLAG)" "RANLIB=$(RANLIB)" "NM=$(NM)" "NM_FOR_BUILD=$(NM_FOR_BUILD)" "NM_FOR_TARGET=$(NM_FOR_TARGET)" "DESTDIR=$(DESTDIR)" "WERROR=$(WERROR)" AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
"CFLAGS=$(CFLAGS)" \
"CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"EXPECT=$(EXPECT)" \
"RUNTEST=$(RUNTEST)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"includedir=$(includedir)" \
"prefix=$(prefix)" \
"tooldir=$(tooldir)" \
"AR=$(AR)" \
"AS=$(AS)" \
"CC=$(CC)" \
"CXX=$(CXX)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"NM=$(NM)" \
"NM_FOR_BUILD=$(NM_FOR_BUILD)" \
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
"DESTDIR=$(DESTDIR)" \
"WERROR=$(WERROR)"
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
CONFIG_HEADER = config.h CONFIG_HEADER = config.h

View file

@ -0,0 +1,382 @@
Changes made while bringing boost/concept_check.hpp to v3's concept_check.h:
1) File format changed from DOS to Unix.
2) Boost config.hpp and other workaround files dropped (unneeded in g++ v3).
3) Conditionally-compiled code depending on those "breakage" macros was
removed, or not, depending on the macro, so that the macros themselves
are gone. Since the same code would always be compiled, let's make it
easier on the reader and a few milliseconds faster for cpplib.
4) Tests for NDEBUG were removed; if NDEBUG is defined, none of the checking
code will even be included.
5) BOOST_CLASS_REQUIRES* changed to accept a namespace parameter.
6) SameTypeConcept added (simple wrapper around existing code).
7) An unused variable in OutputIteratorConcept was removed.
At checkin, this was the exact diff, modulo the end-of-line character changes:
--- concept_check.hpp.orig Sun Apr 1 08:59:46 2001
+++ boost_concept_check.h Mon Apr 2 18:56:41 2001
@@ -5,20 +5,15 @@
// "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
-#include <boost/config.hpp>
-#include <boost/iterator.hpp>
-#include <boost/iterator.hpp>
-#include <utility>
-#include <boost/pending/limits.hpp>
-
-#if (__GNUC__) || defined(__KCC) || defined(__ghs) || defined(__MWERKS__)
-#define BOOST_FPTR &
-#else
-#define BOOST_FPTR
-#endif
+#pragma GCC system_header
+#include <bits/stl_iterator_base_types.h> // for traits and tags
+#include <utility> // for pair<>
+
namespace boost {
@@ -27,80 +22,64 @@
template <class Concept>
void function_requires()
{
-#if !defined(NDEBUG)
- void (Concept::*x)() = BOOST_FPTR Concept::constraints;
+ void (Concept::*x)() = &Concept::constraints;
ignore_unused_variable_warning(x);
-#endif
}
-// The BOOST_CLASS_REQUIRES macros use function pointers as
-// template parameters, which VC++ does not support.
-
-#if defined(BOOST_NO_FUNCTION_PTR_TEMPLATE_PARAMETERS)
-
-#define BOOST_CLASS_REQUIRES(type_var, concept)
-#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept)
-#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept)
-#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, concept)
-#else
-
-#define BOOST_CLASS_REQUIRES(type_var, concept) \
- typedef void (concept <type_var>::* func##type_var##concept)(); \
+#define BOOST_CLASS_REQUIRES(type_var, ns, concept) \
+ typedef void (ns::concept <type_var>::* func##type_var##concept)(); \
template <func##type_var##concept _Tp1> \
struct concept_checking_##type_var##concept { }; \
typedef concept_checking_##type_var##concept< \
- BOOST_FPTR concept <type_var>::constraints> \
+ &ns::concept <type_var>::constraints> \
concept_checking_typedef_##type_var##concept
-#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept) \
- typedef void (concept <type_var1,type_var2>::* func##type_var1##type_var2##concept)(); \
+#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, ns, concept) \
+ typedef void (ns::concept <type_var1,type_var2>::* func##type_var1##type_var2##concept)(); \
template <func##type_var1##type_var2##concept _Tp1> \
struct concept_checking_##type_var1##type_var2##concept { }; \
typedef concept_checking_##type_var1##type_var2##concept< \
- BOOST_FPTR concept <type_var1,type_var2>::constraints> \
+ &ns::concept <type_var1,type_var2>::constraints> \
concept_checking_typedef_##type_var1##type_var2##concept
-#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept) \
- typedef void (concept <type_var1,type_var2,type_var3>::* func##type_var1##type_var2##type_var3##concept)(); \
+#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, ns, concept) \
+ typedef void (ns::concept <type_var1,type_var2,type_var3>::* func##type_var1##type_var2##type_var3##concept)(); \
template <func##type_var1##type_var2##type_var3##concept _Tp1> \
struct concept_checking_##type_var1##type_var2##type_var3##concept { }; \
typedef concept_checking_##type_var1##type_var2##type_var3##concept< \
- BOOST_FPTR concept <type_var1,type_var2,type_var3>::constraints> \
+ &ns::concept <type_var1,type_var2,type_var3>::constraints> \
concept_checking_typedef_##type_var1##type_var2##type_var3##concept
-#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, concept) \
- typedef void (concept <type_var1,type_var2,type_var3,type_var4>::* func##type_var1##type_var2##type_var3##type_var4##concept)(); \
+#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, ns, concept) \
+ typedef void (ns::concept <type_var1,type_var2,type_var3,type_var4>::* func##type_var1##type_var2##type_var3##type_var4##concept)(); \
template <func##type_var1##type_var2##type_var3##type_var4##concept _Tp1> \
struct concept_checking_##type_var1##type_var2##type_var3##type_var4##concept { }; \
typedef concept_checking_##type_var1##type_var2##type_var3##type_var4##concept< \
- BOOST_FPTR concept <type_var1,type_var2,type_var3,type_var4>::constraints> \
+ &ns::concept <type_var1,type_var2,type_var3,type_var4>::constraints> \
concept_checking_typedef_##type_var1##type_var2##type_var3##type_var4##concept
-#endif
-
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T, class U>
struct require_same { };
template <class T>
struct require_same<T,T> { typedef T type; };
-#else
-// This version does not perform checking, but will not do any harm.
-template <class T, class U>
-struct require_same { typedef T type; };
-#endif
+
+ template <class T, class U>
+ struct SameTypeConcept
+ {
+ void constraints() {
+ typedef typename require_same<T, U>::type req;
+ }
+ };
template <class T>
struct IntegerConcept {
void constraints() {
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
errortype_must_be_an_integer_type();
-#endif
}
};
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <> struct IntegerConcept<short> { void constraints() {} };
template <> struct IntegerConcept<unsigned short> { void constraints() {} };
template <> struct IntegerConcept<int> { void constraints() {} };
@@ -108,32 +87,24 @@
template <> struct IntegerConcept<long> { void constraints() {} };
template <> struct IntegerConcept<unsigned long> { void constraints() {} };
// etc.
-#endif
template <class T>
struct SignedIntegerConcept {
void constraints() {
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
errortype_must_be_a_signed_integer_type();
-#endif
}
};
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <> struct SignedIntegerConcept<short> { void constraints() {} };
template <> struct SignedIntegerConcept<int> { void constraints() {} };
template <> struct SignedIntegerConcept<long> { void constraints() {} };
// etc.
-#endif
template <class T>
struct UnsignedIntegerConcept {
void constraints() {
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
errortype_must_be_an_unsigned_integer_type();
-#endif
}
};
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <> struct UnsignedIntegerConcept<unsigned short>
{ void constraints() {} };
template <> struct UnsignedIntegerConcept<unsigned int>
@@ -141,7 +112,6 @@
template <> struct UnsignedIntegerConcept<unsigned long>
{ void constraints() {} };
// etc.
-#endif
//===========================================================================
// Basic Concepts
@@ -159,15 +129,11 @@
struct AssignableConcept
{
void constraints() {
-#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
a = a; // require assignment operator
-#endif
const_constraints(a);
}
void const_constraints(const TT& b) {
-#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
a = b; // const required for argument to assignment
-#endif
}
TT a;
};
@@ -196,17 +162,13 @@
{
void constraints() {
TT b(a);
-#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
a = a; // require assignment operator
-#endif
const_constraints(a);
ignore_unused_variable_warning(b);
}
void const_constraints(const TT& b) {
TT c(b);
-#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
a = b; // const required for argument to assignment
-#endif
ignore_unused_variable_warning(c);
}
TT a;
@@ -304,6 +266,9 @@
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
@@ -318,7 +283,6 @@
};
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class Func>
struct GeneratorConcept<Func,void>
{
@@ -327,7 +291,6 @@
}
Func f;
};
-#endif
template <class Func, class Return, class Arg>
struct UnaryFunctionConcept
@@ -340,7 +303,6 @@
Return r;
};
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class Func, class Arg>
struct UnaryFunctionConcept<Func, void, Arg> {
void constraints() {
@@ -348,7 +310,6 @@
}
Func f;
};
-#endif
template <class Func, class Return, class First, class Second>
struct BinaryFunctionConcept
@@ -362,7 +323,6 @@
Return r;
};
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class Func, class First, class Second>
struct BinaryFunctionConcept<Func, void, First, Second>
{
@@ -373,7 +333,6 @@
First first;
Second second;
};
-#endif
template <class Func, class Arg>
struct UnaryPredicateConcept
@@ -422,9 +381,7 @@
function_requires< AssignableConcept<TT> >();
function_requires< DefaultConstructibleConcept<TT> >();
function_requires< EqualityComparableConcept<TT> >();
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
typedef typename std::iterator_traits<TT>::value_type V;
-#endif
(void)*i; // require dereference operator
}
TT i;
@@ -446,7 +403,6 @@
void constraints() {
function_requires< TrivialIteratorConcept<TT> >();
// require iterator_traits typedef's
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
typedef typename std::iterator_traits<TT>::difference_type D;
function_requires< SignedIntegerConcept<D> >();
typedef typename std::iterator_traits<TT>::reference R;
@@ -455,7 +411,6 @@
function_requires< ConvertibleConcept<
typename std::iterator_traits<TT>::iterator_category,
std::input_iterator_tag> >();
-#endif
++i; // require preincrement operator
i++; // require postincrement operator
}
@@ -471,7 +426,7 @@
i++; // require postincrement operator
*i++ = t; // require postincrement and assignment
}
- TT i, j;
+ TT i;
ValueT t;
};
@@ -480,14 +435,12 @@
{
void constraints() {
function_requires< InputIteratorConcept<TT> >();
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
function_requires< ConvertibleConcept<
typename std::iterator_traits<TT>::iterator_category,
std::forward_iterator_tag> >();
typedef typename std::iterator_traits<TT>::reference reference;
reference r = *i;
ignore_unused_variable_warning(r);
-#endif
}
TT i;
};
@@ -507,11 +460,9 @@
{
void constraints() {
function_requires< ForwardIteratorConcept<TT> >();
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
function_requires< ConvertibleConcept<
typename std::iterator_traits<TT>::iterator_category,
std::bidirectional_iterator_tag> >();
-#endif
--i; // require predecrement operator
i--; // require postdecrement operator
}
@@ -536,12 +487,10 @@
void constraints() {
function_requires< BidirectionalIteratorConcept<TT> >();
function_requires< ComparableConcept<TT> >();
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
function_requires< ConvertibleConcept<
typename std::iterator_traits<TT>::iterator_category,
std::random_access_iterator_tag> >();
typedef typename std::iterator_traits<TT>::reference R;
-#endif
i += n; // require assignment addition operator
i = i + n; i = n + i; // require addition with difference type
@@ -552,11 +501,7 @@
}
TT a, b;
TT i, j;
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
typename std::iterator_traits<TT>::difference_type n;
-#else
- std::ptrdiff_t n;
-#endif
};
template <class TT>
@@ -568,11 +513,7 @@
i[n] = *i; // require element access and assignment
}
TT i;
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
typename std::iterator_traits<TT>::difference_type n;
-#else
- std::ptrdiff_t n;
-#endif
};
//===========================================================================

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 17</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 17</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.6 2000/12/03 23:47:47 jsm28 Exp $ --> <!-- $Id: howto.html,v 1.1 2000/12/10 04:03:09 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -144,9 +144,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.1 2000/12/10 04:03:09 pme Exp $
<BR> $Id: howto.html,v 1.6 2000/12/03 23:47:47 jsm28 Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 18</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 18</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.7 2000/12/03 23:47:47 jsm28 Exp $ --> <!-- $Id: howto.html,v 1.1 2000/12/10 04:04:54 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -259,9 +259,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.1 2000/12/10 04:04:54 pme Exp $
<BR> $Id: howto.html,v 1.7 2000/12/03 23:47:47 jsm28 Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 19</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 19</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.1 2000/12/10 04:04:54 pme Exp $ --> <!-- $Id: howto.html,v 1.2 2001/03/25 00:01:56 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -26,7 +26,7 @@
<UL> <UL>
<LI><A HREF="#1">Adding data to exceptions</A> <LI><A HREF="#1">Adding data to exceptions</A>
<LI><A HREF="#2">Exception class hierarchy diagram</A> <LI><A HREF="#2">Exception class hierarchy diagram</A>
<LI><A HREF="#3">Concept checkers</A> <LI><A HREF="#3">Concept checkers -- <STRONG>new and improved!</STRONG></A>
</UL> </UL>
<HR> <HR>
@ -67,58 +67,44 @@
</P> </P>
<HR> <HR>
<H2><A NAME="3">Concept checkers</A></H2> <H2><A NAME="3">Concept checkers -- <STRONG>new and improved!</STRONG></A></H2>
<P>First the good news, then the bad news.</P> <P>Better taste! Less fat! Literally!</P>
<P><STRONG>Good news:</STRONG> As part of their 3.3 release, SGI <P>In 1999, SGI added <EM>concept checkers</EM> to their implementation
added some nifty macros which of the STL: code which checked the template parameters of
perform assertions on type properties. For example, the Standard instantiated pieces of the STL, in order to insure that the parameters
requires that types passed as template parameters to <TT>vector</TT> being used met the requirements of the standard. For example,
be &quot;Assignable&quot; (which means what you think it means). the Standard requires that types passed as template parameters to
<TT>vector</TT> be &quot;Assignable&quot; (which means what you think
it means). The checking was done during compilation, and none of
the code was executed at runtime.
</P> </P>
<P>The concept checkers allow the source code for <TT>vector</TT> to <P>Unfortunately, the size of the compiler files grew significantly
declare as a result. The checking code itself was cumbersome. And bugs
<PRE> were found in it on more than one occasion.
__STL_CLASS_REQUIRES(_Tp, _Assignable);
</PRE>inside the template. <TT>_Tp</TT> is the element type of the
vector, and <TT>_Assignable</TT> is the concept to be checked (it is
defined in some back-end header files). When you instantiate
<TT>vector&lt;MyType&gt;</TT>, compile-time checking can be done on
whether MyType meets the requirements for vectors.
</P> </P>
<P>Most (all?) of the containers and sequences are capable of performing <P>The primary author of the checking code, Jeremy Siek, had already
concept checking during compilation, not just vector. started work on a replcement implementation. The new code has been
formally reviewed and accepted into
<A HREF="http://www.boost.org/libs/concept_check/concept_check.htm">the
Boost libraries</A>, and we are pleased to incorporate it into the
GNU C++ library.
</P> </P>
<P>If a concept is violated (thus causing a compilation failure), the <P>The new version imposes a much smaller space overhead on the generated
error messages printed by the compiler will be of the form object file. The checks are also cleaner and easier to read and
<PRE> understand.
_STL_ERROR::__<EM>foo</EM>_violation
</PRE> where <EM>foo</EM> 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.
</P> </P>
<P>Other names might be seen for more specific errors, for example, <P>Concept checking can be disabled when you build your code, for example,
_ERROR_IN_STL_CONTAINER::__begin_iterator_accessor_requirement_violation. to save space during a production build. Just define (via -D or
#define) any of the macros
<TT>_GLIBCPP_NO_CONCEPT_CHECKS (yes, with the leading underscore),
<TT>_STL_NO_CONCEPT_CHECKS</TT> (also with the leading underscore),
or <TT>NDEBUG</TT>. 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 <TT>assert()</TT>, which is often turned
off for production builds.
</P> </P>
<P>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.
</P>
<P><STRONG>Bad news:</STRONG> 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.
</P>
<P>Concept checking can be disabled when you build your code. Just
define (via -D or #define) the macro
<TT>_STL_NO_CONCEPT_CHECKS</TT> (yes, with the leading underscore).
In fact, this may already be defined in the library by default,
depending on what decision we come to.
</P>
<P><STRONG>More good news:</STRONG> 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.
<P>Return <A HREF="#top">to top of page</A> or <P>Return <A HREF="#top">to top of page</A> or
<A HREF="../faq/index.html">to the FAQ</A>. <A HREF="../faq/index.html">to the FAQ</A>.
</P> </P>
@ -129,9 +115,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.2 2001/03/25 00:01:56 pme Exp $
<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:54 pme Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 20</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 20</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.1 2000/12/10 04:04:54 pme Exp $ --> <!-- $Id: howto.html,v 1.2 2001/01/23 17:02:27 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -212,9 +212,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.2 2001/01/23 17:02:27 pme Exp $
<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:54 pme Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 21</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 21</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $ --> <!-- $Id: howto.html,v 1.2 2001/02/07 00:03:20 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -329,9 +329,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.2 2001/02/07 00:03:20 pme Exp $
<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 22</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 22</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $ --> <!-- $Id: howto.html,v 1.2 2001/02/07 00:03:20 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -225,9 +225,8 @@ functionality are given.
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.2 2001/02/07 00:03:20 pme Exp $
<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 23</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 23</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.4 2000/12/03 23:47:48 jsm28 Exp $ --> <!-- $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -235,9 +235,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
<BR> $Id: howto.html,v 1.4 2000/12/03 23:47:48 jsm28 Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 24</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 24</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.5 2000/12/03 23:47:48 jsm28 Exp $ --> <!-- $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -84,9 +84,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
<BR> $Id: howto.html,v 1.5 2000/12/03 23:47:48 jsm28 Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 25</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 25</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.5 2000/12/03 23:47:48 jsm28 Exp $ --> <!-- $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -86,9 +86,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
<BR> $Id: howto.html,v 1.5 2000/12/03 23:47:48 jsm28 Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 26</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 26</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.7 2000/12/03 23:47:48 jsm28 Exp $ --> <!-- $Id: howto.html,v 1.1 2000/12/10 04:04:56 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -132,9 +132,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.1 2000/12/10 04:04:56 pme Exp $
<BR> $Id: howto.html,v 1.7 2000/12/03 23:47:48 jsm28 Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Chapter 27</TITLE> <TITLE>libstdc++-v3 HOWTO: Chapter 27</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.2 2001/01/23 17:02:27 pme Exp $ --> <!-- $Id: howto.html,v 1.3 2001/02/07 00:03:21 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -415,9 +415,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.3 2001/02/07 00:03:21 pme Exp $
<BR> $Id: howto.html,v 1.2 2001/01/23 17:02:27 pme Exp $
</EM></P> </EM></P>

View file

@ -8,7 +8,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 HOWTO: Extensions</TITLE> <TITLE>libstdc++-v3 HOWTO: Extensions</TITLE>
<LINK REL=StyleSheet HREF="../lib3styles.css"> <LINK REL=StyleSheet HREF="../lib3styles.css">
<!-- $Id: howto.html,v 1.1 2000/12/10 04:04:56 pme Exp $ --> <!-- $Id: howto.html,v 1.2 2001/03/25 00:01:56 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -141,8 +141,8 @@
<HR> <HR>
<H2><A NAME="4">Compile-time checks</A></H2> <H2><A NAME="4">Compile-time checks</A></H2>
<P>Currently libstdc++-v3 uses the concept checkers from SGI's STL <P>Currently libstdc++-v3 uses the concept checkers from the Boost
3.3 to perform <A HREF="../19_diagnostics/howto.html#3">optional library to perform <A HREF="../19_diagnostics/howto.html#3">optional
compile-time checking</A> of template instantiations of the standard compile-time checking</A> of template instantiations of the standard
containers. They are described in the linked-to page. containers. They are described in the linked-to page.
</P> </P>
@ -158,9 +158,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: howto.html,v 1.2 2001/03/25 00:01:56 pme Exp $
<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:56 pme Exp $
</EM></P> </EM></P>

View file

@ -9,7 +9,7 @@
** Locations of "the most recent snapshot is the Nth" text are ** Locations of "the most recent snapshot is the Nth" text are
** answers 1_1, 1_4, 4_1, 5_6. ** answers 1_1, 1_4, 4_1, 5_6.
--> -->
<!-- $Id: index.html,v 1.4 2001/03/01 22:32:23 pme Exp $ --> <!-- $Id: index.html,v 1.5 2001/03/25 00:01:57 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -62,15 +62,16 @@ http://gcc.gnu.org/onlinedocs/libstdc++/faq/</A>.</P>
<LI><A HREF="#4_2">Bugs in gcc/g++ (not libstdc++-v3)</A> <LI><A HREF="#4_2">Bugs in gcc/g++ (not libstdc++-v3)</A>
<LI><A HREF="#4_3">Bugs in the C++ language/lib specification</A> <LI><A HREF="#4_3">Bugs in the C++ language/lib specification</A>
<LI><A HREF="#4_4">Things in libstdc++ that look like bugs</A> <LI><A HREF="#4_4">Things in libstdc++ that look like bugs</A>
<UL> <UL>
<LI><A HREF="#4_4_Weff">-Weffc++ complains too much</A> <LI><A HREF="#4_4_Weff">-Weffc++ complains too much</A>
<LI><A HREF="#4_4_rel_ops">&quot;ambiguous overloads&quot; <LI><A HREF="#4_4_rel_ops">&quot;ambiguous overloads&quot;
after including an old-style header</A> after including an old-style header</A>
<LI><A HREF="#4_4_interface">The g++-3 headers are <LI><A HREF="#4_4_interface">The g++-3 headers are
<STRONG>not ours</STRONG></A> <STRONG>not ours</STRONG></A>
<LI><A HREF="#4_4_glibc">compilation errors from streambuf.h</A> <LI><A HREF="#4_4_glibc">compilation errors from streambuf.h</A>
<LI><A HREF="#4_4_checks">_STL_ERROR::__something_huge_...</A> <LI><A HREF="#4_4_checks">errors about <EM>*Cconcept</EM> and
</UL> <EM>constraints</EM> in the STL...</A>
</UL>
<LI><A HREF="#4_5">Aw, that's easy to fix!</A> <LI><A HREF="#4_5">Aw, that's easy to fix!</A>
</OL> </OL>
@ -258,7 +259,7 @@ which is no longer available, thanks deja...-->
that building GCC is much easier and more automated that building GCC is much easier and more automated
than building the GCC 2.[78] series was. than building the GCC 2.[78] series was.
<LI> If you plan on hacking around with the makefiles, you <LI> If you plan on hacking around with the makefiles, you
will need the tools <A will need the tools <A
HREF="http://sources.redhat.com/autoconf/">autoconf</A>and <A HREF="http://sources.redhat.com/autoconf/">autoconf</A>and <A
HREF="http://sources.redhat.com/automake/">automake</A>. HREF="http://sources.redhat.com/automake/">automake</A>.
<LI> GNU Make is the only make that supports these makefiles. <LI> GNU Make is the only make that supports these makefiles.
@ -289,11 +290,11 @@ HREF="http://sources.redhat.com/automake/">automake</A>.
keep mentioning?</A></H2> keep mentioning?</A></H2>
<P>The <EM>Concurrent Versions System</EM> is one of several revision <P>The <EM>Concurrent Versions System</EM> is one of several revision
control packages. It was selected for GNU projects because it's control packages. It was selected for GNU projects because it's
free (speech), free (beer), and very high quality. The <A free (speech), free (beer), and very high quality. The <A
HREF="http://www.gnu.org/software/cvs/cvs.html">CVS entry in HREF="http://www.gnu.org/software/cvs/cvs.html">CVS entry in
the GNU software catalogue</A> has a better description as the GNU software catalogue</A> has a better description as
well as a well as a
<A HREF="http://www.cyclic.com/">link to the makers of CVS</A>. <A HREF="http://www.cyclic.com/">link to the makers of CVS</A>.
</P> </P>
<P>The &quot;anonymous client checkout&quot; feature of CVS is <P>The &quot;anonymous client checkout&quot; feature of CVS is
similar to anonymous FTP in that it allows anyone to retrieve similar to anonymous FTP in that it allows anyone to retrieve
@ -371,7 +372,7 @@ HREF="http://sources.redhat.com/automake/">automake</A>.
</P> </P>
<P>You have two options. You can get a newer cygwin1.dll (see the <P>You have two options. You can get a newer cygwin1.dll (see the
Cygwin paragraph in the Cygwin paragraph in the
<A HREF="../install.html">installation instructions</A>). <A HREF="../install.html">installation instructions</A>).
Or you can get a prebuilt set of bits/std_limits.h and Or you can get a prebuilt set of bits/std_limits.h and
src/limitsMEMBERS.cc files from Mumit Khan's src/limitsMEMBERS.cc files from Mumit Khan's
<A HREF="http://www.xraylith.wisc.edu/~khan/software/gnu-win32/libstdc++-v3.html">Cygwin-related website</A>. <A HREF="http://www.xraylith.wisc.edu/~khan/software/gnu-win32/libstdc++-v3.html">Cygwin-related website</A>.
@ -381,15 +382,15 @@ HREF="http://sources.redhat.com/automake/">automake</A>.
<H2><A NAME="3_3">3.3 Building DEC OSF kills the assembler</A></H2> <H2><A NAME="3_3">3.3 Building DEC OSF kills the assembler</A></H2>
<P>The <TT>atomicity.h</TT> header for the Alpha processor <P>The <TT>atomicity.h</TT> header for the Alpha processor
currently uses pseudo-operators which the DEC assembler currently uses pseudo-operators which the DEC assembler
doesn't understand (in particular, .subsection and .previous). doesn't understand (in particular, .subsection and .previous).
The simple solution is to install GNU <TT>as</TT> and arrange The simple solution is to install GNU <TT>as</TT> and arrange
for the GCC build to use it (or merge the sources and build for the GCC build to use it (or merge the sources and build
it during the bootstrap). it during the bootstrap).
</P> </P>
<P>Anyone who <P>Anyone who
<A HREF="http://gcc.gnu.org/ml/libstdc++/2000-12/msg00279.html">knows <A HREF="http://gcc.gnu.org/ml/libstdc++/2000-12/msg00279.html">knows
the DEC assembler well enough</A> to provide the equivalent of the DEC assembler well enough</A> to provide the equivalent of
these two pseudos would win praise and accolades from many. these two pseudos would win praise and accolades from many.
</P> </P>
@ -511,12 +512,12 @@ to the list</A>, Nathan Myers announced that he has started a list of
<A NAME="4_4_rel_ops"> <A NAME="4_4_rel_ops">
<P>Another is the <TT>rel_ops</TT> namespace and the template <P>Another is the <TT>rel_ops</TT> namespace and the template
comparison operator functions contained therein. If they become comparison operator functions contained therein. If they become
visible in the same namespace as other comparison functions visible in the same namespace as other comparison functions
(e.g., '<TT>using</TT>' them and the &lt;iterator&gt; header), (e.g., '<TT>using</TT>' them and the &lt;iterator&gt; header),
then you will suddenly be faced with huge numbers of ambiguity then you will suddenly be faced with huge numbers of ambiguity
errors. This was discussed on the -v3 list; Nathan Myers errors. This was discussed on the -v3 list; Nathan Myers
<A HREF="http://gcc.gnu.org/ml/libstdc++/2001-01/msg00247.html">sums <A HREF="http://gcc.gnu.org/ml/libstdc++/2001-01/msg00247.html">sums
things up here</A>. things up here</A>.
</P> </P>
</A> </A>
<A NAME="4_4_interface"><H3>The g++-3 headers are <A NAME="4_4_interface"><H3>The g++-3 headers are
@ -541,8 +542,8 @@ to the list</A>, Nathan Myers announced that he has started a list of
</A> </A>
<A NAME="4_4_glibc"> <A NAME="4_4_glibc">
<P>If you're on a GNU/Linux system and have just upgraded to <P>If you're on a GNU/Linux system and have just upgraded to
glibc 2.2, but are still using gcc 2.95.2, then you should have glibc 2.2, but are still using gcc 2.95.2, then you should have
read the glibc FAQ, specifically 2.34: read the glibc FAQ, specifically 2.34:
<PRE> <PRE>
2.34. When compiling C++ programs, I get a compilation error in streambuf.h. 2.34. When compiling C++ programs, I get a compilation error in streambuf.h.
@ -551,24 +552,24 @@ apply a patch to the include files in /usr/include/g++, because the fpos_t
type has changed in glibc 2.2. The patch is at type has changed in glibc 2.2. The patch is at
http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
</PRE> </PRE>
Note that 2.95.x shipped with the Note that 2.95.x shipped with the
<A HREF="#4_4_interface">old v2 library</A> which is no longer <A HREF="#4_4_interface">old v2 library</A> which is no longer
maintained. maintained.
</P> </P>
</A> </A>
<A NAME="4_4_checks"> <A NAME="4_4_checks">
<P>If you see compilation errors containing messages which begin <P>If you see compilation errors containing messages about
with _STL_ERROR:: followed by a very verbose name, then most <TT> <EM>foo</EM>Concept </TT>and a<TT> constraints </TT>
likely you have violated one of the requirements for types used member function, then most
during instantiation of template containers. For example, likely you have violated one of the requirements for types used
_STL_ERROR::__equality_comparable_requirement_violation appears during instantiation of template containers. For example,
EqualityComparableConcept appears
if your types must be comparable with == and you have not if your types must be comparable with == and you have not
provided this capability (a typo, or wrong visibility, or you provided this capability (a typo, or wrong visibility, or you
just plain forgot, etc). just plain forgot, etc).
</P> </P>
<P>More information, including how to optionally disable the checks, <P>More information, including how to optionally disable the checks,
is available <A HREF="../19_diagnostics/howto.html#3">here</A>. is available <A HREF="../19_diagnostics/howto.html#3">here</A>.
The code itself might be disabled or replaced already.
</P> </P>
</A> </A>
@ -579,7 +580,7 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
on <A HREF="http://gcc.gnu.org/contribute.html">submitting on <A HREF="http://gcc.gnu.org/contribute.html">submitting
patches</A> that covers the procedure, but for libstdc++ you patches</A> that covers the procedure, but for libstdc++ you
should also send the patch to our mailing list in addition to 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++
<A HREF="../17_intro/contribute.html">contributors' page</A> <A HREF="../17_intro/contribute.html">contributors' page</A>
also talks about how to submit patches. also talks about how to submit patches.
</P> </P>
@ -720,9 +721,8 @@ HREF="http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html">speculation</A>.
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: index.html,v 1.5 2001/03/25 00:01:57 pme Exp $
<BR> $Id: index.html,v 1.4 2001/03/01 22:32:23 pme Exp $
</EM></P> </EM></P>

View file

@ -38,7 +38,7 @@
header header
o [28]The g++-3 headers are not ours o [28]The g++-3 headers are not ours
o [29]compilation errors from streambuf.h 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. [31]Aw, that's easy to fix!
5. [32]Miscellaneous 5. [32]Miscellaneous
1. [33]string::iterator is not char*; vector<T>::iterator is not 1. [33]string::iterator is not char*; vector<T>::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 Note that 2.95.x shipped with the [68]old v2 library which is no
longer maintained. longer maintained.
If you see compilation errors containing messages which begin with If you see compilation errors containing messages about fooConcept and
_STL_ERROR:: followed by a very verbose name, then most likely you a constraints member function, then most likely you have violated one
have violated one of the requirements for types used during of the requirements for types used during instantiation of template
instantiation of template containers. For example, containers. For example, EqualityComparableConcept appears if your
_STL_ERROR::__equality_comparable_requirement_violation appears if types must be comparable with == and you have not provided this
your types must be comparable with == and you have not provided this
capability (a typo, or wrong visibility, or you just plain forgot, capability (a typo, or wrong visibility, or you just plain forgot,
etc). etc).
More information, including how to optionally disable the checks, is More information, including how to optionally disable the checks, is
available [69]here. The code itself might be disabled or replaced available [69]here.
already.
_________________________________________________________________ _________________________________________________________________
4.5 Aw, that's easy to fix! 4.5 Aw, that's easy to fix!
@ -573,9 +571,9 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
out! out!
_________________________________________________________________ _________________________________________________________________
Comments and suggestions are welcome, and may be sent to [83]Phil Comments and suggestions are welcome, and may be sent to [83]the
Edwards or [84]Gabriel Dos Reis. mailing list.
$Id: index.html,v 1.4 2001/03/01 22:32:23 pme Exp $ $Id: index.html,v 1.5 2001/03/25 00:01:57 pme Exp $
References References
@ -661,5 +659,4 @@ References
80. http://www.ansi.org/ 80. http://www.ansi.org/
81. http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998 81. http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998
82. http://www.iso.ch/ 82. http://www.iso.ch/
83. mailto:pme@sources.redhat.com 83. mailto:libstdc++@gcc.gnu.org
84. mailto:gdr@gcc.gnu.org

View file

@ -7,7 +7,7 @@
<META NAME="GENERATOR" CONTENT="vi and eight fingers"> <META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>libstdc++-v3 Installation Instructions</TITLE> <TITLE>libstdc++-v3 Installation Instructions</TITLE>
<LINK REL=StyleSheet HREF="lib3styles.css"> <LINK REL=StyleSheet HREF="lib3styles.css">
<!-- $Id: install.html,v 1.3 2001/01/23 17:02:26 pme Exp $ --> <!-- $Id: install.html,v 1.4 2001/02/07 00:03:20 pme Exp $ -->
</HEAD> </HEAD>
<BODY> <BODY>
@ -333,9 +333,8 @@
<HR> <HR>
<P CLASS="fineprint"><EM> <P CLASS="fineprint"><EM>
Comments and suggestions are welcome, and may be sent to Comments and suggestions are welcome, and may be sent to
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or <A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. <BR> $Id: install.html,v 1.4 2001/02/07 00:03:20 pme Exp $
<BR> $Id: install.html,v 1.3 2001/01/23 17:02:26 pme Exp $
</EM></P> </EM></P>

View file

@ -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 <bits/stl_iterator_base_types.h> // for traits and tags
#include <utility> // for pair<>
namespace boost {
template <class T> void ignore_unused_variable_warning(const T&) { }
template <class Concept>
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 <type_var>::* func##type_var##concept)(); \
template <func##type_var##concept _Tp1> \
struct concept_checking_##type_var##concept { }; \
typedef concept_checking_##type_var##concept< \
&ns::concept <type_var>::constraints> \
concept_checking_typedef_##type_var##concept
#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, ns, concept) \
typedef void (ns::concept <type_var1,type_var2>::* func##type_var1##type_var2##concept)(); \
template <func##type_var1##type_var2##concept _Tp1> \
struct concept_checking_##type_var1##type_var2##concept { }; \
typedef concept_checking_##type_var1##type_var2##concept< \
&ns::concept <type_var1,type_var2>::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 <type_var1,type_var2,type_var3>::* func##type_var1##type_var2##type_var3##concept)(); \
template <func##type_var1##type_var2##type_var3##concept _Tp1> \
struct concept_checking_##type_var1##type_var2##type_var3##concept { }; \
typedef concept_checking_##type_var1##type_var2##type_var3##concept< \
&ns::concept <type_var1,type_var2,type_var3>::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 <type_var1,type_var2,type_var3,type_var4>::* func##type_var1##type_var2##type_var3##type_var4##concept)(); \
template <func##type_var1##type_var2##type_var3##type_var4##concept _Tp1> \
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 <type_var1,type_var2,type_var3,type_var4>::constraints> \
concept_checking_typedef_##type_var1##type_var2##type_var3##type_var4##concept
template <class T, class U>
struct require_same { };
template <class T>
struct require_same<T,T> { typedef T type; };
template <class T, class U>
struct SameTypeConcept
{
void constraints() {
typedef typename require_same<T, U>::type req;
}
};
template <class T>
struct IntegerConcept {
void constraints() {
errortype_must_be_an_integer_type();
}
};
template <> struct IntegerConcept<short> { void constraints() {} };
template <> struct IntegerConcept<unsigned short> { void constraints() {} };
template <> struct IntegerConcept<int> { void constraints() {} };
template <> struct IntegerConcept<unsigned int> { void constraints() {} };
template <> struct IntegerConcept<long> { void constraints() {} };
template <> struct IntegerConcept<unsigned long> { void constraints() {} };
// etc.
template <class T>
struct SignedIntegerConcept {
void constraints() {
errortype_must_be_a_signed_integer_type();
}
};
template <> struct SignedIntegerConcept<short> { void constraints() {} };
template <> struct SignedIntegerConcept<int> { void constraints() {} };
template <> struct SignedIntegerConcept<long> { void constraints() {} };
// etc.
template <class T>
struct UnsignedIntegerConcept {
void constraints() {
errortype_must_be_an_unsigned_integer_type();
}
};
template <> struct UnsignedIntegerConcept<unsigned short>
{ void constraints() {} };
template <> struct UnsignedIntegerConcept<unsigned int>
{ void constraints() {} };
template <> struct UnsignedIntegerConcept<unsigned long>
{ void constraints() {} };
// etc.
//===========================================================================
// Basic Concepts
template <class TT>
struct DefaultConstructibleConcept
{
void constraints() {
TT a; // require default constructor
ignore_unused_variable_warning(a);
}
};
template <class TT>
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 <class TT>
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 <class TT>
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 <class X, class Y>
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 <class TT>
void require_boolean_expr(const TT& t) {
bool x = t;
ignore_unused_variable_warning(x);
}
template <class TT>
struct EqualityComparableConcept
{
void constraints() {
require_boolean_expr(a == b);
require_boolean_expr(a != b);
}
TT a, b;
};
template <class TT>
struct LessThanComparableConcept
{
void constraints() {
require_boolean_expr(a < b);
}
TT a, b;
};
// This is equivalent to SGI STL's LessThanComparable.
template <class TT>
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 <class First, class Second> \
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 <class Ret, class First, class Second> \
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 <class Func, class Return>
struct GeneratorConcept
{
void constraints() {
const Return& r = f(); // require operator() member function
ignore_unused_variable_warning(r);
}
Func f;
};
template <class Func>
struct GeneratorConcept<Func,void>
{
void constraints() {
f(); // require operator() member function
}
Func f;
};
template <class Func, class Return, class Arg>
struct UnaryFunctionConcept
{
void constraints() {
r = f(arg); // require operator()
}
Func f;
Arg arg;
Return r;
};
template <class Func, class Arg>
struct UnaryFunctionConcept<Func, void, Arg> {
void constraints() {
f(arg); // require operator()
}
Func f;
};
template <class Func, class Return, class First, class Second>
struct BinaryFunctionConcept
{
void constraints() {
r = f(first, second); // require operator()
}
Func f;
First first;
Second second;
Return r;
};
template <class Func, class First, class Second>
struct BinaryFunctionConcept<Func, void, First, Second>
{
void constraints() {
f(first, second); // require operator()
}
Func f;
First first;
Second second;
};
template <class Func, class Arg>
struct UnaryPredicateConcept
{
void constraints() {
require_boolean_expr(f(arg)); // require operator() returning bool
}
Func f;
Arg arg;
};
template <class Func, class First, class Second>
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 <class Func, class First, class Second>
struct Const_BinaryPredicateConcept {
void constraints() {
const_constraints(f);
}
void const_constraints(const Func& fun) {
function_requires<BinaryPredicateConcept<Func, First, Second> >();
// operator() must be a const member function
require_boolean_expr(fun(a, b));
}
Func f;
First a;
Second b;
};
//===========================================================================
// Iterator Concepts
template <class TT>
struct TrivialIteratorConcept
{
void constraints() {
function_requires< AssignableConcept<TT> >();
function_requires< DefaultConstructibleConcept<TT> >();
function_requires< EqualityComparableConcept<TT> >();
typedef typename std::iterator_traits<TT>::value_type V;
(void)*i; // require dereference operator
}
TT i;
};
template <class TT>
struct Mutable_TrivialIteratorConcept
{
void constraints() {
function_requires< TrivialIteratorConcept<TT> >();
*i = *j; // require dereference and assignment
}
TT i, j;
};
template <class TT>
struct InputIteratorConcept
{
void constraints() {
function_requires< TrivialIteratorConcept<TT> >();
// require iterator_traits typedef's
typedef typename std::iterator_traits<TT>::difference_type D;
function_requires< SignedIntegerConcept<D> >();
typedef typename std::iterator_traits<TT>::reference R;
typedef typename std::iterator_traits<TT>::pointer P;
typedef typename std::iterator_traits<TT>::iterator_category C;
function_requires< ConvertibleConcept<
typename std::iterator_traits<TT>::iterator_category,
std::input_iterator_tag> >();
++i; // require preincrement operator
i++; // require postincrement operator
}
TT i;
};
template <class TT, class ValueT>
struct OutputIteratorConcept
{
void constraints() {
function_requires< AssignableConcept<TT> >();
++i; // require preincrement operator
i++; // require postincrement operator
*i++ = t; // require postincrement and assignment
}
TT i;
ValueT t;
};
template <class TT>
struct ForwardIteratorConcept
{
void constraints() {
function_requires< InputIteratorConcept<TT> >();
function_requires< ConvertibleConcept<
typename std::iterator_traits<TT>::iterator_category,
std::forward_iterator_tag> >();
typedef typename std::iterator_traits<TT>::reference reference;
reference r = *i;
ignore_unused_variable_warning(r);
}
TT i;
};
template <class TT>
struct Mutable_ForwardIteratorConcept
{
void constraints() {
function_requires< ForwardIteratorConcept<TT> >();
*i++ = *i; // require postincrement and assignment
}
TT i;
};
template <class TT>
struct BidirectionalIteratorConcept
{
void constraints() {
function_requires< ForwardIteratorConcept<TT> >();
function_requires< ConvertibleConcept<
typename std::iterator_traits<TT>::iterator_category,
std::bidirectional_iterator_tag> >();
--i; // require predecrement operator
i--; // require postdecrement operator
}
TT i;
};
template <class TT>
struct Mutable_BidirectionalIteratorConcept
{
void constraints() {
function_requires< BidirectionalIteratorConcept<TT> >();
function_requires< Mutable_ForwardIteratorConcept<TT> >();
*i-- = *i; // require postdecrement and assignment
}
TT i;
};
template <class TT>
struct RandomAccessIteratorConcept
{
void constraints() {
function_requires< BidirectionalIteratorConcept<TT> >();
function_requires< ComparableConcept<TT> >();
function_requires< ConvertibleConcept<
typename std::iterator_traits<TT>::iterator_category,
std::random_access_iterator_tag> >();
typedef typename std::iterator_traits<TT>::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<TT>::difference_type n;
};
template <class TT>
struct Mutable_RandomAccessIteratorConcept
{
void constraints() {
function_requires< RandomAccessIteratorConcept<TT> >();
function_requires< Mutable_BidirectionalIteratorConcept<TT> >();
i[n] = *i; // require element access and assignment
}
TT i;
typename std::iterator_traits<TT>::difference_type n;
};
//===========================================================================
// Container Concepts
template <class Container>
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<const_iterator> >();
function_requires< AssignableConcept<Container> >();
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 <class Container>
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<Container> >();
function_requires< AssignableConcept<value_type> >();
function_requires< InputIteratorConcept<iterator> >();
i = c.begin();
i = c.end();
c.swap(c2);
}
iterator i;
Container c, c2;
};
template <class ForwardContainer>
struct ForwardContainerConcept
{
void constraints() {
function_requires< ContainerConcept<ForwardContainer> >();
typedef typename ForwardContainer::const_iterator const_iterator;
function_requires< ForwardIteratorConcept<const_iterator> >();
}
};
template <class ForwardContainer>
struct Mutable_ForwardContainerConcept
{
void constraints() {
function_requires< ForwardContainerConcept<ForwardContainer> >();
function_requires< Mutable_ContainerConcept<ForwardContainer> >();
typedef typename ForwardContainer::iterator iterator;
function_requires< Mutable_ForwardIteratorConcept<iterator> >();
}
};
template <class ReversibleContainer>
struct ReversibleContainerConcept
{
typedef typename ReversibleContainer::const_iterator const_iterator;
typedef typename ReversibleContainer::const_reverse_iterator
const_reverse_iterator;
void constraints() {
function_requires< ForwardContainerConcept<ReversibleContainer> >();
function_requires< BidirectionalIteratorConcept<const_iterator> >();
function_requires< BidirectionalIteratorConcept<const_reverse_iterator> >();
const ReversibleContainer c;
const_reverse_iterator i = c.rbegin();
i = c.rend();
}
};
template <class ReversibleContainer>
struct Mutable_ReversibleContainerConcept
{
typedef typename ReversibleContainer::iterator iterator;
typedef typename ReversibleContainer::reverse_iterator reverse_iterator;
void constraints() {
function_requires< ReversibleContainerConcept<ReversibleContainer> >();
function_requires< Mutable_ForwardContainerConcept<ReversibleContainer> >();
function_requires< Mutable_BidirectionalIteratorConcept<iterator> >();
function_requires< Mutable_BidirectionalIteratorConcept<reverse_iterator> >();
reverse_iterator i = c.rbegin();
i = c.rend();
}
ReversibleContainer c;
};
template <class RandomAccessContainer>
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<RandomAccessContainer> >();
function_requires< RandomAccessIteratorConcept<const_iterator> >();
function_requires< RandomAccessIteratorConcept<const_reverse_iterator> >();
const RandomAccessContainer c;
const_reference r = c[n];
ignore_unused_variable_warning(r);
}
size_type n;
};
template <class RandomAccessContainer>
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<RandomAccessContainer> >();
function_requires< Mutable_ReversibleContainerConcept<RandomAccessContainer> >();
function_requires< Mutable_RandomAccessIteratorConcept<iterator> >();
function_requires< Mutable_RandomAccessIteratorConcept<reverse_iterator> >();
reference r = c[i];
ignore_unused_variable_warning(r);
}
size_type i;
RandomAccessContainer c;
};
// A Sequence is inherently mutable
template <class Sequence>
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<Sequence> >();
function_requires< Mutable_ForwardContainerConcept<Sequence> >();
function_requires< DefaultConstructibleConcept<Sequence> >();
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 <class FrontInsertionSequence>
struct FrontInsertionSequenceConcept
{
void constraints() {
function_requires< SequenceConcept<FrontInsertionSequence> >();
c.push_front(t);
c.pop_front();
}
FrontInsertionSequence c;
typename FrontInsertionSequence::value_type t;
};
template <class BackInsertionSequence>
struct BackInsertionSequenceConcept
{
typedef typename BackInsertionSequence::reference reference;
typedef typename BackInsertionSequence::const_reference const_reference;
void constraints() {
function_requires< SequenceConcept<BackInsertionSequence> >();
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 <class AssociativeContainer>
struct AssociativeContainerConcept
{
void constraints() {
function_requires< ForwardContainerConcept<AssociativeContainer> >();
function_requires< DefaultConstructibleConcept<AssociativeContainer> >();
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<iterator,iterator> r;
const_iterator ci;
std::pair<const_iterator,const_iterator> cr;
typename AssociativeContainer::key_type k;
typename AssociativeContainer::size_type n;
};
template <class UniqueAssociativeContainer>
struct UniqueAssociativeContainerConcept
{
void constraints() {
function_requires< AssociativeContainerConcept<UniqueAssociativeContainer> >();
UniqueAssociativeContainer c(first, last);
pos_flag = c.insert(t);
c.insert(first, last);
ignore_unused_variable_warning(c);
}
std::pair<typename UniqueAssociativeContainer::iterator, bool> pos_flag;
typename UniqueAssociativeContainer::value_type t;
typename UniqueAssociativeContainer::value_type* first, *last;
};
template <class MultipleAssociativeContainer>
struct MultipleAssociativeContainerConcept
{
void constraints() {
function_requires< AssociativeContainerConcept<MultipleAssociativeContainer> >();
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 <class SimpleAssociativeContainer>
struct SimpleAssociativeContainerConcept
{
void constraints() {
function_requires< AssociativeContainerConcept<SimpleAssociativeContainer> >();
typedef typename SimpleAssociativeContainer::key_type key_type;
typedef typename SimpleAssociativeContainer::value_type value_type;
typedef typename require_same<key_type, value_type>::type req;
}
};
template <class SimpleAssociativeContainer>
struct PairAssociativeContainerConcept
{
void constraints() {
function_requires< AssociativeContainerConcept<SimpleAssociativeContainer> >();
typedef typename SimpleAssociativeContainer::key_type key_type;
typedef typename SimpleAssociativeContainer::value_type value_type;
typedef typename SimpleAssociativeContainer::mapped_type mapped_type;
typedef std::pair<const key_type, mapped_type> required_value_type;
typedef typename require_same<value_type, required_value_type>::type req;
}
};
template <class SortedAssociativeContainer>
struct SortedAssociativeContainerConcept
{
void constraints() {
function_requires< AssociativeContainerConcept<SortedAssociativeContainer> >();
function_requires< ReversibleContainerConcept<SortedAssociativeContainer> >();
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<iterator,iterator> r;
std::pair<const_iterator,const_iterator> cr;
typename SortedAssociativeContainer::value_type* first, *last;
};
// HashedAssociativeContainer
} // namespace boost
#endif // BOOST_CONCEPT_CHECKS_HPP

View file

@ -63,9 +63,8 @@
# define __STL_UITHREADS # define __STL_UITHREADS
#endif #endif
// Concept-checking code is off by default unless users define // Concept-checking hooks and related config are now in bits/concept_check.h.
// the _STL_USE_CONCEPT_CHECKS hook.
//#define _STL_USE_CONCEPT_CHECKS 1
// This is also a user hook, but via -f[no-]exceptions, not direct #defines. // This is also a user hook, but via -f[no-]exceptions, not direct #defines.
#ifdef __EXCEPTIONS #ifdef __EXCEPTIONS
@ -85,7 +84,8 @@
# define __STL_UNWIND(action) # define __STL_UNWIND(action)
#endif #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 __USE_MALLOC
// Define this to permit user-level control of the expansion of string // Define this to permit user-level control of the expansion of string
@ -105,11 +105,6 @@
//# define __STL_LONG_LONG //# define __STL_LONG_LONG
//#endif //#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 // Mingw32, GCC compiler using the Microsoft C runtime (settings taken from
// SGI's stl_config.h) // SGI's stl_config.h)
#if defined(__MINGW32__) #if defined(__MINGW32__)

View file

@ -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 <bits/c++config.h>
// 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 <bits/boost_concept_check.h>
// 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<Foo,Bar>)" 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

View file

@ -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 <class _Tp>
struct _Mutable_trait {
typedef _Tp _Type;
};
template <class _Tp>
struct _Mutable_trait<const _Tp> {
typedef _Tp _Type;
};
/* helper function for avoiding compiler warnings about unused variables */
template <class _Type>
void __sink_unused_warning(_Type) { }
template <class _TypeX, class _TypeY>
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 <class _Type> struct __check_equal { };
template <class _TypeX, class _TypeY>
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 <class _Func, class _Ret>
struct _STL_GENERATOR_ERROR {
static _Ret __generator_requirement_violation(_Func& __f) {
return __f();
}
};
template <class _Func>
struct _STL_GENERATOR_ERROR<_Func, void> {
static void __generator_requirement_violation(_Func& __f) {
__f();
}
};
template <class _Func, class _Ret, class _Arg>
struct _STL_UNARY_FUNCTION_ERROR {
static _Ret
__unary_function_requirement_violation(_Func& __f,
const _Arg& __arg) {
return __f(__arg);
}
};
template <class _Func, class _Arg>
struct _STL_UNARY_FUNCTION_ERROR<_Func, void, _Arg> {
static void
__unary_function_requirement_violation(_Func& __f,
const _Arg& __arg) {
__f(__arg);
}
};
template <class _Func, class _Ret, class _First, class _Second>
struct _STL_BINARY_FUNCTION_ERROR {
static _Ret
__binary_function_requirement_violation(_Func& __f,
const _First& __first,
const _Second& __second) {
return __f(__first, __second);
}
};
template <class _Func, class _First, class _Second>
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 <class _Ret, class _First, class _Second> \
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 <class _Type>
static _Type
__default_constructor_requirement_violation(_Type) {
return _Type();
}
template <class _Type>
static _Type
__assignment_operator_requirement_violation(_Type __a) {
__a = __a;
return __a;
}
template <class _Type>
static _Type
__copy_constructor_requirement_violation(_Type __a) {
_Type __c(__a);
return __c;
}
template <class _Type>
static _Type
__const_parameter_required_for_copy_constructor(_Type /* __a */,
const _Type& __b) {
_Type __c(__b);
return __c;
}
template <class _Type>
static _Type
__const_parameter_required_for_assignment_operator(_Type __a,
const _Type& __b) {
__a = __b;
return __a;
}
template <class _Type>
static _Type
__less_than_comparable_requirement_violation(_Type __a, _Type __b) {
if (__a < __b) return __a;
return __b;
}
template <class _Type>
static _Type
__equality_comparable_requirement_violation(_Type __a, _Type __b) {
if (__a == __b || __a != __b) return __a;
return __b;
}
template <class _Iterator>
static void
__dereference_operator_requirement_violation(_Iterator __i) {
__sink_unused_warning(*__i);
}
template <class _Iterator>
static void
__dereference_operator_and_assignment_requirement_violation(_Iterator __i) {
*__i = *__i;
}
template <class _Iterator>
static void
__preincrement_operator_requirement_violation(_Iterator __i) {
++__i;
}
template <class _Iterator>
static void
__postincrement_operator_requirement_violation(_Iterator __i) {
__i++;
}
template <class _Iterator>
static void
__predecrement_operator_requirement_violation(_Iterator __i) {
--__i;
}
template <class _Iterator>
static void
__postdecrement_operator_requirement_violation(_Iterator __i) {
__i--;
}
template <class _Iterator, class _Type>
static void
__postincrement_operator_and_assignment_requirement_violation(_Iterator __i,
_Type __t) {
*__i++ = __t;
}
template <class _Iterator, class _Distance>
static _Iterator
__iterator_addition_assignment_requirement_violation(_Iterator __i,
_Distance __n) {
__i += __n;
return __i;
}
template <class _Iterator, class _Distance>
static _Iterator
__iterator_addition_requirement_violation(_Iterator __i, _Distance __n) {
__i = __i + __n;
__i = __n + __i;
return __i;
}
template <class _Iterator, class _Distance>
static _Iterator
__iterator_subtraction_assignment_requirement_violation(_Iterator __i,
_Distance __n) {
__i -= __n;
return __i;
}
template <class _Iterator, class _Distance>
static _Iterator
__iterator_subtraction_requirement_violation(_Iterator __i, _Distance __n) {
__i = __i - __n;
return __i;
}
template <class _Iterator, class _Distance>
static _Distance
__difference_operator_requirement_violation(_Iterator __i, _Iterator __j,
_Distance __n) {
__n = __i - __j;
return __n;
}
template <class _Exp, class _Type, class _Distance>
static _Type
__element_access_operator_requirement_violation(_Exp __x, _Type*,
_Distance __n) {
return __x[__n];
}
template <class _Exp, class _Type, class _Distance>
static void
__element_assignment_operator_requirement_violation(_Exp __x,
_Type* __t,
_Distance __n) {
__x[__n] = *__t;
}
}; /* _STL_ERROR */
/* Associated Type Requirements */
namespace std
{
template <class _Iterator> struct iterator_traits;
} // namespace std
template <class _Iter>
struct __value_type_type_definition_requirement_violation {
typedef typename std::iterator_traits<_Iter>::value_type value_type;
};
template <class _Iter>
struct __difference_type_type_definition_requirement_violation {
typedef typename std::iterator_traits<_Iter>::difference_type
difference_type;
};
template <class _Iter>
struct __reference_type_definition_requirement_violation {
typedef typename std::iterator_traits<_Iter>::reference reference;
};
template <class _Iter>
struct __pointer_type_definition_requirement_violation {
typedef typename std::iterator_traits<_Iter>::pointer pointer;
};
template <class _Iter>
struct __iterator_category_type_definition_requirement_violation {
typedef typename std::iterator_traits<_Iter>::iterator_category
iterator_category;
};
/* Assignable Requirements */
template <class _Type>
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 <class _Type>
struct _DefaultConstructible_concept_specification {
static void _DefaultConstructible_requirement_violation(_Type __a) {
_STL_ERROR::__default_constructor_requirement_violation(__a);
}
};
/* EqualityComparable Requirements */
template <class _Type>
struct _EqualityComparable_concept_specification {
static void _EqualityComparable_requirement_violation(_Type __a) {
_STL_ERROR::__equality_comparable_requirement_violation(__a, __a);
}
};
/* LessThanComparable Requirements */
template <class _Type>
struct _LessThanComparable_concept_specification {
static void _LessThanComparable_requirement_violation(_Type __a) {
_STL_ERROR::__less_than_comparable_requirement_violation(__a, __a);
}
};
/* TrivialIterator Requirements */
template <class _TrivialIterator>
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 <class _TrivialIterator>
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 <class _InputIterator>
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 <class _OutputIterator>
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 <class _ForwardIterator>
struct _ForwardIterator_concept_specification {
static void
_ForwardIterator_requirement_violation(_ForwardIterator __i) {
// Refinement of InputIterator
_InputIterator_concept_specification<_ForwardIterator>::
_InputIterator_requirement_violation(__i);
}
};
template <class _ForwardIterator>
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 <class _BidirectionalIterator>
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 <class _BidirectionalIterator>
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 <class _RandAccIter>
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<value_type>::_Type* __dummy_ptr = 0;
_STL_ERROR::__element_access_operator_requirement_violation(__i,
__dummy_ptr,
_MutDist());
}
};
template <class _RandAccIter>
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<value_type>::_Type* __tmp_ptr = 0;
// Valid Expressions
_STL_ERROR::__element_assignment_operator_requirement_violation(__i,
__tmp_ptr, _Dist());
}
};
#define __STL_TYPEDEF_REQUIREMENT(__REQUIREMENT) \
template <class Type> \
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 <class _Alloc>
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:

View file

@ -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 <bits/concept_checks.h>
#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 <class _Container>
static void
__begin_iterator_accessor_requirement_violation(_Container __c) {
__c.begin();
}
template <class _Container>
static void
__const_begin_iterator_accessor_requirement_violation(const _Container& __c) {
__c.begin();
}
template <class _Container>
static void
__end_iterator_accessor_requirement_violation(_Container __c) {
__c.end();
}
template <class _Container>
static void
__const_end_iterator_accessor_requirement_violation(const _Container& __c) {
__c.end();
}
template <class _Container>
static void
__rbegin_iterator_accessor_requirement_violation(_Container __c) {
__c.rbegin();
}
template <class _Container>
static void
__const_rbegin_iterator_accessor_requirement_violation(const _Container& __c) {
__c.rbegin();
}
template <class _Container>
static void
__rend_iterator_accessor_requirement_violation(_Container __c) {
__c.rend();
}
template <class _Container>
static void
__const_rend_iterator_accessor_requirement_violation(const _Container& __c) {
__c.rend();
}
template <class _Container>
static void
__size_function_must_be_const(const _Container& __c) {
__c.size();
}
template <class _Container>
static void
__size_function_requirement_violation(_Container& __c) {
__c.size();
__size_function_must_be_const(__c);
}
template <class _Container>
static void
__max_size_function_must_be_const(const _Container& __c) {
__c.max_size();
}
template <class _Container>
static void
__max_size_function_requirement_violation(_Container& __c) {
__c.max_size();
__max_size_function_must_be_const(__c);
}
template <class _Container>
static void
__empty_function_must_be_const(const _Container& __c) {
__c.empty();
}
template <class _Container>
static void
__empty_function_requirement_violation(_Container& __c) {
__c.empty();
__empty_function_must_be_const(__c);
}
template <class _Container>
static void
__swap_function_requirement_violation(_Container& __c) {
__c.swap(__c);
}
};
__STL_TYPEDEF_REQUIREMENT(iterator);
__STL_TYPEDEF_REQUIREMENT(const_iterator);
/* Containers */
template <class _Container>
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<const_iter>::_InputIterator_requirement_violation(const_iter());
_InputIterator_concept_specification<iter>::_InputIterator_requirement_violation(iter());
}
};
template <class _ForwardContainer>
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<const_iter>::_ForwardIterator_requirement_violation(const_iter());
_Mutable_ForwardIterator_concept_specification<iter>::_Mutable_ForwardIterator_requirement_violation(iter());
}
};
__STL_TYPEDEF_REQUIREMENT(reverse_iterator);
__STL_TYPEDEF_REQUIREMENT(const_reverse_iterator);
template <class _ReversibleContainer>
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<const_iter>::_BidirectionalIterator_requirement_violation(const_iter());
_Mutable_BidirectionalIterator_concept_specification<iter>::_Mutable_BidirectionalIterator_requirement_violation(iter());
}
};
template <class _ReversibleContainer>
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<const_iter>::_BidirectionalIterator_requirement_violation(const_iter());
}
};
template <class _RandomAccessContainer>
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<const_iter>::_RandomAccessIterator_requirement_violation(const_iter());
_Mutable_RandomAccessIterator_concept_specification<iter>::_Mutable_RandomAccessIterator_requirement_violation(iter());
}
};
#endif /* if __STL_USE_CONCEPT_CHECKS */
#endif /* __STL_CONTAINER_CONCEPTS_H */

View file

@ -39,7 +39,7 @@ namespace std
template<typename _CharT, typename _Traits> template<typename _CharT, typename _Traits>
class ostreambuf_iterator class ostreambuf_iterator
#if 0 // XXX this is standard: #if 1 // XXX this is standard:
: public iterator<output_iterator_tag, _CharT, void, void, void> : public iterator<output_iterator_tag, _CharT, void, void, void>
#else #else
: public output_iterator : public output_iterator

View file

@ -1,206 +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_SEQUENCE_CONCEPTS_H
#define _STL_SEQUENCE_CONCEPTS_H 1
#pragma GCC system_header
#include <bits/container_concepts.h>
#ifdef __STL_USE_CONCEPT_CHECKS
// This file covers the following concepts:
// _Sequence
// _FrontInsertionSequence
// _BackInsertionSequence
struct _ERROR_IN_STL_SEQ {
template <class _XX>
static void
__fill_constructor_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
typename _XX::difference_type __n = typename _XX::difference_type();
_XX __x(__n, __t);
__sink_unused_warning(__x);
}
template <class _XX>
static void
__fill_default_constructor_requirement_violation(_XX& __s) {
_STL_ERROR::__default_constructor_requirement_violation(*__s.begin());
typename _XX::difference_type __n = typename _XX::difference_type();
_XX __x(__n);
__sink_unused_warning(__x);
}
template <class _XX>
static void
__range_constructor_requirement_violation(_XX& __s) {
_XX __x(__s.begin(), __s.end());
__sink_unused_warning(__x);
}
template <class _XX>
static void
__insert_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
typename _XX::iterator __p = typename _XX::iterator();
__p = __s.insert(__p, __t);
}
template <class _XX>
static void
__fill_insert_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
typename _XX::iterator __p = typename _XX::iterator();
typename _XX::difference_type __n = typename _XX::difference_type();
__s.insert(__p, __n, __t);
}
template <class _XX>
static void
__range_insert_function_requirement_violation(_XX& __s) {
typename _XX::iterator __p = typename _XX::iterator();
typename _XX::iterator __i = typename _XX::iterator();
typename _XX::iterator __j = typename _XX::iterator();
__s.insert(__p, __i, __j);
}
template <class _XX>
static void
__insert_element_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
std::pair<typename _XX::iterator, bool> __r;
__r = __s.insert(__t);
__sink_unused_warning(__r);
}
template <class _XX>
static void
__unconditional_insert_element_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
typename _XX::iterator __p;
__p = __s.insert(__t);
__sink_unused_warning(__p);
}
template <class _XX>
static void
__erase_function_requirement_violation(_XX& __s) {
typename _XX::iterator __p = typename _XX::iterator();
__p = __s.erase(__p);
}
template <class _XX>
static void
__range_erase_function_requirement_violation(_XX& __s) {
typename _XX::iterator __p = typename _XX::iterator();
typename _XX::iterator __q = typename _XX::iterator();
__p = __s.erase(__p, __q);
}
template <class _XX>
static void
__const_front_function_requirement_violation(const _XX& __s) {
typename _XX::const_reference __t = __s.front();
__sink_unused_warning(__t);
}
template <class _XX>
static void
__front_function_requirement_violation(_XX& __s) {
typename _XX::reference __t = __s.front();
__const_front_function_requirement_violation(__s);
__sink_unused_warning(__t);
}
template <class _XX>
static void
__const_back_function_requirement_violation(const _XX& __s) {
typename _XX::const_reference __t = __s.back();
__sink_unused_warning(__t);
}
template <class _XX>
static void
__back_function_requirement_violation(_XX& __s) {
typename _XX::reference __t = __s.back();
__const_back_function_requirement_violation(__s);
__sink_unused_warning(__t);
}
template <class _XX>
static void
__push_front_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
__s.push_front(__t);
}
template <class _XX>
static void
__pop_front_function_requirement_violation(_XX& __s) {
__s.pop_front();
}
template <class _XX>
static void
__push_back_function_requirement_violation(_XX& __s) {
typename _XX::value_type __t = typename _XX::value_type();
__s.push_back(__t);
}
template <class _XX>
static void
__pop_back_function_requirement_violation(_XX& __s) {
__s.pop_back();
}
};
/* Sequence Containers */
template <class _Sequence>
struct _Sequence_concept_specification {
static void
_Sequence_requirement_violation(_Sequence __s) {
// Refinement of ForwardContainer
_ForwardContainer_concept_specification<_Sequence>::_ForwardContainer_requirement_violation(__s);
// Refinement of DefaultConstructible
_DefaultConstructible_concept_specification<_Sequence>::_DefaultConstructible_requirement_violation(__s);
// Valid Expressions
_ERROR_IN_STL_SEQ::__fill_constructor_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__fill_default_constructor_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__range_constructor_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__insert_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__fill_insert_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__range_insert_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__erase_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__range_erase_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__front_function_requirement_violation(__s);
}
};
template <class _FrontInsertionSequence>
struct _FrontInsertionSequence_concept_specification {
static void
_FrontInsertionSequence_requirement_violation(_FrontInsertionSequence __s) {
// Refinement of Sequence
_Sequence_concept_specification<_FrontInsertionSequence>::_Sequence_requirement_violation(__s);
// Valid Expressions
_ERROR_IN_STL_SEQ::__push_front_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__pop_front_function_requirement_violation(__s);
}
};
template <class _BackInsertionSequence>
struct _BackInsertionSequence_concept_specification {
static void
_BackInsertionSequence_requirement_violation(_BackInsertionSequence __s) {
// Refinement of Sequence
_Sequence_concept_specification<_BackInsertionSequence>::_Sequence_requirement_violation(__s);
// Valid Expressions
_ERROR_IN_STL_SEQ::__back_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__push_back_function_requirement_violation(__s);
_ERROR_IN_STL_SEQ::__pop_back_function_requirement_violation(__s);
}
};
#endif /* if __STL_USE_CONCEPT_CHECKS */
#endif /* _STL_SEQUENCE_CONCEPTS_H */

View file

@ -31,7 +31,8 @@
#include <bits/c++config.h> #include <bits/c++config.h>
#include <bits/std_cstddef.h> #include <bits/std_cstddef.h>
#include <bits/std_iosfwd.h> #include <bits/std_iosfwd.h>
#include <bits/stl_iterator_base.h> #include <bits/stl_iterator_base_types.h>
#include <bits/stl_iterator_base_funcs.h>
#include <bits/stl_iterator.h> #include <bits/stl_iterator.h>
#endif /* _CPP_ITERATOR */ #endif /* _CPP_ITERATOR */

View file

@ -20,7 +20,7 @@
#include <bits/stl_algobase.h> #include <bits/stl_algobase.h>
#include <bits/stl_alloc.h> #include <bits/stl_alloc.h>
#include <bits/stl_construct.h> #include <bits/stl_construct.h>
#include <bits/stl_iterator_base.h> //for iterator_traits #include <bits/stl_iterator_base_types.h> //for iterator_traits
#include <bits/stl_tempbuf.h> #include <bits/stl_tempbuf.h>
#include <bits/stl_uninitialized.h> #include <bits/stl_uninitialized.h>
#include <bits/stl_raw_storage_iter.h> #include <bits/stl_raw_storage_iter.h>

File diff suppressed because it is too large Load diff

View file

@ -46,10 +46,10 @@
#include <new> #include <new>
#include <bits/std_iosfwd.h> #include <bits/std_iosfwd.h>
#include <bits/stl_iterator_base.h> #include <bits/stl_iterator_base_types.h>
#include <bits/stl_iterator_base_funcs.h>
#include <bits/stl_iterator.h> #include <bits/stl_iterator.h>
#include <bits/concept_check.h>
// We pick up concept_checks.h from stl_iterator_base.h.
namespace std namespace std
{ {
@ -57,26 +57,35 @@ namespace std
// swap and iter_swap // swap and iter_swap
template <class _ForwardIter1, class _ForwardIter2, class _Tp> template <class _ForwardIter1, class _ForwardIter2, class _Tp>
inline void __iter_swap(_ForwardIter1 __a, _ForwardIter2 __b, _Tp*) { inline void __iter_swap(_ForwardIter1 __a, _ForwardIter2 __b, _Tp*)
{
_Tp __tmp = *__a; _Tp __tmp = *__a;
*__a = *__b; *__a = *__b;
*__b = __tmp; *__b = __tmp;
} }
template <class _ForwardIter1, class _ForwardIter2> template <class _ForwardIter1, class _ForwardIter2>
inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b) { inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b)
__STL_REQUIRES(_ForwardIter1, _Mutable_ForwardIterator); {
__STL_REQUIRES(_ForwardIter2, _Mutable_ForwardIterator); // concept requirements
__STL_CONVERTIBLE(typename iterator_traits<_ForwardIter1>::value_type, glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter1>);
typename iterator_traits<_ForwardIter2>::value_type); glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter2>);
__STL_CONVERTIBLE(typename iterator_traits<_ForwardIter2>::value_type, glibcpp_function_requires(ConvertibleConcept<
typename iterator_traits<_ForwardIter1>::value_type); typename iterator_traits<_ForwardIter1>::value_type,
__iter_swap(__a, __b, __VALUE_TYPE(__a)); typename iterator_traits<_ForwardIter2>::value_type>);
glibcpp_function_requires(ConvertibleConcept<
typename iterator_traits<_ForwardIter2>::value_type,
typename iterator_traits<_ForwardIter1>::value_type>);
__iter_swap(__a, __b, __value_type(__a));
} }
template <class _Tp> template <class _Tp>
inline void swap(_Tp& __a, _Tp& __b) { inline void swap(_Tp& __a, _Tp& __b)
__STL_REQUIRES(_Tp, _Assignable); {
// concept requirements
glibcpp_function_requires(SGIAssignableConcept<_Tp>);
_Tp __tmp = __a; _Tp __tmp = __a;
__a = __b; __a = __b;
__b = __tmp; __b = __tmp;
@ -90,14 +99,16 @@ inline void swap(_Tp& __a, _Tp& __b) {
template <class _Tp> template <class _Tp>
inline const _Tp& min(const _Tp& __a, const _Tp& __b) { inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
__STL_REQUIRES(_Tp, _LessThanComparable); // concept requirements
glibcpp_function_requires(LessThanComparableConcept<_Tp>);
//return __b < __a ? __b : __a; //return __b < __a ? __b : __a;
if (__b < __a) return __b; return __a; if (__b < __a) return __b; return __a;
} }
template <class _Tp> template <class _Tp>
inline const _Tp& max(const _Tp& __a, const _Tp& __b) { inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
__STL_REQUIRES(_Tp, _LessThanComparable); // concept requirements
glibcpp_function_requires(LessThanComparableConcept<_Tp>);
//return __a < __b ? __b : __a; //return __a < __b ? __b : __a;
if (__a < __b) return __b; return __a; if (__a < __b) return __b; return __a;
} }
@ -148,7 +159,8 @@ __copy(_RandomAccessIter __first, _RandomAccessIter __last,
template <class _Tp> template <class _Tp>
inline _Tp* inline _Tp*
__copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) { __copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result)
{
memmove(__result, __first, sizeof(_Tp) * (__last - __first)); memmove(__result, __first, sizeof(_Tp) * (__last - __first));
return __result + (__last - __first); return __result + (__last - __first);
} }
@ -156,40 +168,41 @@ __copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) {
template <class _InputIter, class _OutputIter> template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last, inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last,
_OutputIter __result, __false_type) { _OutputIter __result, __false_type)
{
return __copy(__first, __last, __result, return __copy(__first, __last, __result,
__ITERATOR_CATEGORY(__first), __iterator_category(__first),
__DISTANCE_TYPE(__first)); __distance_type(__first));
} }
template <class _InputIter, class _OutputIter> template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last, inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last,
_OutputIter __result, __true_type) { _OutputIter __result, __true_type)
{
return __copy(__first, __last, __result, return __copy(__first, __last, __result,
__ITERATOR_CATEGORY(__first), __iterator_category(__first),
__DISTANCE_TYPE(__first)); __distance_type(__first));
} }
#ifndef __USLC__
template <class _Tp> template <class _Tp>
inline _Tp* __copy_aux2(_Tp* __first, _Tp* __last, _Tp* __result, inline _Tp* __copy_aux2(_Tp* __first, _Tp* __last, _Tp* __result,
__true_type) { __true_type)
{
return __copy_trivial(__first, __last, __result); return __copy_trivial(__first, __last, __result);
} }
#endif /* __USLC__ */
template <class _Tp> template <class _Tp>
inline _Tp* __copy_aux2(const _Tp* __first, const _Tp* __last, _Tp* __result, inline _Tp* __copy_aux2(const _Tp* __first, const _Tp* __last, _Tp* __result,
__true_type) { __true_type)
{
return __copy_trivial(__first, __last, __result); return __copy_trivial(__first, __last, __result);
} }
template <class _InputIter, class _OutputIter, class _Tp> template <class _InputIter, class _OutputIter, class _Tp>
inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last,
_OutputIter __result, _Tp*) { _OutputIter __result, _Tp*)
{
typedef typename __type_traits<_Tp>::has_trivial_assignment_operator typedef typename __type_traits<_Tp>::has_trivial_assignment_operator
_Trivial; _Trivial;
return __copy_aux2(__first, __last, __result, _Trivial()); return __copy_aux2(__first, __last, __result, _Trivial());
@ -197,36 +210,44 @@ inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last,
template<typename _InputIter, typename _OutputIter> template<typename _InputIter, typename _OutputIter>
inline _OutputIter __copy_ni2(_InputIter __first, _InputIter __last, inline _OutputIter __copy_ni2(_InputIter __first, _InputIter __last,
_OutputIter __result, __true_type) { _OutputIter __result, __true_type)
{
return _OutputIter(__copy_aux(__first, __last, __result.base(), return _OutputIter(__copy_aux(__first, __last, __result.base(),
__VALUE_TYPE(__first))); __value_type(__first)));
} }
template<typename _InputIter, typename _OutputIter> template<typename _InputIter, typename _OutputIter>
inline _OutputIter __copy_ni2(_InputIter __first, _InputIter __last, inline _OutputIter __copy_ni2(_InputIter __first, _InputIter __last,
_OutputIter __result, __false_type) { _OutputIter __result, __false_type)
return __copy_aux(__first, __last, __result, __VALUE_TYPE(__first)); {
return __copy_aux(__first, __last, __result, __value_type(__first));
} }
template<typename _InputIter, typename _OutputIter> template<typename _InputIter, typename _OutputIter>
inline _OutputIter __copy_ni1(_InputIter __first, _InputIter __last, inline _OutputIter __copy_ni1(_InputIter __first, _InputIter __last,
_OutputIter __result, __true_type) { _OutputIter __result, __true_type)
{
typedef typename _Is_normal_iterator<_OutputIter>::_Normal __Normal; typedef typename _Is_normal_iterator<_OutputIter>::_Normal __Normal;
return __copy_ni2(__first.base(), __last.base(), __result, __Normal()); return __copy_ni2(__first.base(), __last.base(), __result, __Normal());
} }
template<typename _InputIter, typename _OutputIter> template<typename _InputIter, typename _OutputIter>
inline _OutputIter __copy_ni1(_InputIter __first, _InputIter __last, inline _OutputIter __copy_ni1(_InputIter __first, _InputIter __last,
_OutputIter __result, __false_type) { _OutputIter __result, __false_type)
{
typedef typename _Is_normal_iterator<_OutputIter>::_Normal __Normal; typedef typename _Is_normal_iterator<_OutputIter>::_Normal __Normal;
return __copy_ni2(__first, __last, __result, __Normal()); return __copy_ni2(__first, __last, __result, __Normal());
} }
template <class _InputIter, class _OutputIter> template <class _InputIter, class _OutputIter>
inline _OutputIter copy(_InputIter __first, _InputIter __last, inline _OutputIter copy(_InputIter __first, _InputIter __last,
_OutputIter __result) { _OutputIter __result)
__STL_REQUIRES(_InputIter, _InputIterator); {
__STL_REQUIRES(_OutputIter, _OutputIterator); // concept requirements
glibcpp_function_requires(InputIteratorConcept<_InputIter>);
glibcpp_function_requires(OutputIteratorConcept<_OutputIter,
typename iterator_traits<_InputIter>::value_type>);
typedef typename _Is_normal_iterator<_InputIter>::_Normal __Normal; typedef typename _Is_normal_iterator<_InputIter>::_Normal __Normal;
return __copy_ni1(__first, __last, __result, __Normal()); return __copy_ni1(__first, __last, __result, __Normal());
} }
@ -338,11 +359,15 @@ inline _BI2 __copy_backward_input_normal_iterator(_BI1 __first, _BI1 __last,
} }
template <typename _BI1, typename _BI2> template <typename _BI1, typename _BI2>
inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) { inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result)
__STL_REQUIRES(_BI1, _BidirectionalIterator); {
__STL_REQUIRES(_BI2, _Mutable_BidirectionalIterator); // concept requirements
__STL_CONVERTIBLE(typename iterator_traits<_BI1>::value_type, glibcpp_function_requires(BidirectionalIteratorConcept<_BI1>);
typename iterator_traits<_BI2>::value_type); glibcpp_function_requires(Mutable_BidirectionalIteratorConcept<_BI2>);
glibcpp_function_requires(ConvertibleConcept<
typename iterator_traits<_BI1>::value_type,
typename iterator_traits<_BI2>::value_type>);
typedef typename _Is_normal_iterator<_BI1>::_Normal __Normal; typedef typename _Is_normal_iterator<_BI1>::_Normal __Normal;
return __copy_backward_input_normal_iterator(__first, __last, __result, return __copy_backward_input_normal_iterator(__first, __last, __result,
__Normal()); __Normal());
@ -376,14 +401,18 @@ template <class _InputIter, class _Size, class _OutputIter>
inline pair<_InputIter, _OutputIter> inline pair<_InputIter, _OutputIter>
__copy_n(_InputIter __first, _Size __count, _OutputIter __result) { __copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
return __copy_n(__first, __count, __result, return __copy_n(__first, __count, __result,
__ITERATOR_CATEGORY(__first)); __iterator_category(__first));
} }
template <class _InputIter, class _Size, class _OutputIter> template <class _InputIter, class _Size, class _OutputIter>
inline pair<_InputIter, _OutputIter> inline pair<_InputIter, _OutputIter>
copy_n(_InputIter __first, _Size __count, _OutputIter __result) { copy_n(_InputIter __first, _Size __count, _OutputIter __result)
__STL_REQUIRES(_InputIter, _InputIterator); {
__STL_REQUIRES(_OutputIter, _OutputIterator); // concept requirements
glibcpp_function_requires(InputIteratorConcept<_InputIter>);
glibcpp_function_requires(OutputIteratorConcept<_OutputIter,
typename iterator_traits<_InputIter>::value_type>);
return __copy_n(__first, __count, __result); return __copy_n(__first, __count, __result);
} }
@ -392,15 +421,21 @@ copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
template <class _ForwardIter, class _Tp> template <class _ForwardIter, class _Tp>
void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) { void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value)
__STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); {
// concept requirements
glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>);
for ( ; __first != __last; ++__first) for ( ; __first != __last; ++__first)
*__first = __value; *__first = __value;
} }
template <class _OutputIter, class _Size, class _Tp> template <class _OutputIter, class _Size, class _Tp>
_OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) { _OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value)
__STL_REQUIRES(_OutputIter, _OutputIterator); {
// concept requirements
glibcpp_function_requires(OutputIteratorConcept<_OutputIter,_Tp>);
for ( ; __n > 0; --__n, ++__first) for ( ; __n > 0; --__n, ++__first)
*__first = __value; *__first = __value;
return __first; return __first;
@ -409,38 +444,44 @@ _OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) {
// Specialization: for one-byte types we can use memset. // Specialization: for one-byte types we can use memset.
inline void fill(unsigned char* __first, unsigned char* __last, inline void fill(unsigned char* __first, unsigned char* __last,
const unsigned char& __c) { const unsigned char& __c)
{
unsigned char __tmp = __c; unsigned char __tmp = __c;
memset(__first, __tmp, __last - __first); memset(__first, __tmp, __last - __first);
} }
inline void fill(signed char* __first, signed char* __last, inline void fill(signed char* __first, signed char* __last,
const signed char& __c) { const signed char& __c)
{
signed char __tmp = __c; signed char __tmp = __c;
memset(__first, static_cast<unsigned char>(__tmp), __last - __first); memset(__first, static_cast<unsigned char>(__tmp), __last - __first);
} }
inline void fill(char* __first, char* __last, const char& __c) { inline void fill(char* __first, char* __last, const char& __c)
{
char __tmp = __c; char __tmp = __c;
memset(__first, static_cast<unsigned char>(__tmp), __last - __first); memset(__first, static_cast<unsigned char>(__tmp), __last - __first);
} }
template <class _Size> template <class _Size>
inline unsigned char* fill_n(unsigned char* __first, _Size __n, inline unsigned char* fill_n(unsigned char* __first, _Size __n,
const unsigned char& __c) { const unsigned char& __c)
{
fill(__first, __first + __n, __c); fill(__first, __first + __n, __c);
return __first + __n; return __first + __n;
} }
template <class _Size> template <class _Size>
inline signed char* fill_n(char* __first, _Size __n, inline signed char* fill_n(char* __first, _Size __n,
const signed char& __c) { const signed char& __c)
{
fill(__first, __first + __n, __c); fill(__first, __first + __n, __c);
return __first + __n; return __first + __n;
} }
template <class _Size> template <class _Size>
inline char* fill_n(char* __first, _Size __n, const char& __c) { inline char* fill_n(char* __first, _Size __n, const char& __c)
{
fill(__first, __first + __n, __c); fill(__first, __first + __n, __c);
return __first + __n; return __first + __n;
} }
@ -452,13 +493,16 @@ inline char* fill_n(char* __first, _Size __n, const char& __c) {
template <class _InputIter1, class _InputIter2> template <class _InputIter1, class _InputIter2>
pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
_InputIter1 __last1, _InputIter1 __last1,
_InputIter2 __first2) { _InputIter2 __first2)
__STL_REQUIRES(_InputIter1, _InputIterator); {
__STL_REQUIRES(_InputIter2, _InputIterator); // concept requirements
__STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, glibcpp_function_requires(InputIteratorConcept<_InputIter1>);
_EqualityComparable); glibcpp_function_requires(InputIteratorConcept<_InputIter2>);
__STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, glibcpp_function_requires(EqualityComparableConcept<
_EqualityComparable); typename iterator_traits<_InputIter1>::value_type>);
glibcpp_function_requires(EqualityComparableConcept<
typename iterator_traits<_InputIter2>::value_type>);
while (__first1 != __last1 && *__first1 == *__first2) { while (__first1 != __last1 && *__first1 == *__first2) {
++__first1; ++__first1;
++__first2; ++__first2;
@ -470,9 +514,12 @@ template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
_InputIter1 __last1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __first2,
_BinaryPredicate __binary_pred) { _BinaryPredicate __binary_pred)
__STL_REQUIRES(_InputIter1, _InputIterator); {
__STL_REQUIRES(_InputIter2, _InputIterator); // concept requirements
glibcpp_function_requires(InputIteratorConcept<_InputIter1>);
glibcpp_function_requires(InputIteratorConcept<_InputIter2>);
while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) { while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
++__first1; ++__first1;
++__first2; ++__first2;
@ -482,13 +529,16 @@ pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
template <class _InputIter1, class _InputIter2> template <class _InputIter1, class _InputIter2>
inline bool equal(_InputIter1 __first1, _InputIter1 __last1, inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2) { _InputIter2 __first2)
__STL_REQUIRES(_InputIter1, _InputIterator); {
__STL_REQUIRES(_InputIter2, _InputIterator); // concept requirements
__STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, glibcpp_function_requires(InputIteratorConcept<_InputIter1>);
_EqualityComparable); glibcpp_function_requires(InputIteratorConcept<_InputIter2>);
__STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, glibcpp_function_requires(EqualityComparableConcept<
_EqualityComparable); typename iterator_traits<_InputIter1>::value_type>);
glibcpp_function_requires(EqualityComparableConcept<
typename iterator_traits<_InputIter2>::value_type>);
for ( ; __first1 != __last1; ++__first1, ++__first2) for ( ; __first1 != __last1; ++__first1, ++__first2)
if (*__first1 != *__first2) if (*__first1 != *__first2)
return false; return false;
@ -497,9 +547,12 @@ inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
template <class _InputIter1, class _InputIter2, class _BinaryPredicate> template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
inline bool equal(_InputIter1 __first1, _InputIter1 __last1, inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _BinaryPredicate __binary_pred) { _InputIter2 __first2, _BinaryPredicate __binary_pred)
__STL_REQUIRES(_InputIter1, _InputIterator); {
__STL_REQUIRES(_InputIter2, _InputIterator); // concept requirements
glibcpp_function_requires(InputIteratorConcept<_InputIter1>);
glibcpp_function_requires(InputIteratorConcept<_InputIter2>);
for ( ; __first1 != __last1; ++__first1, ++__first2) for ( ; __first1 != __last1; ++__first1, ++__first2)
if (!__binary_pred(*__first1, *__first2)) if (!__binary_pred(*__first1, *__first2))
return false; return false;
@ -512,13 +565,16 @@ inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
template <class _InputIter1, class _InputIter2> template <class _InputIter1, class _InputIter2>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2) { _InputIter2 __first2, _InputIter2 __last2)
__STL_REQUIRES(_InputIter1, _InputIterator); {
__STL_REQUIRES(_InputIter2, _InputIterator); // concept requirements
__STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, glibcpp_function_requires(InputIteratorConcept<_InputIter1>);
_LessThanComparable); glibcpp_function_requires(InputIteratorConcept<_InputIter2>);
__STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, glibcpp_function_requires(LessThanComparableConcept<
_LessThanComparable); typename iterator_traits<_InputIter1>::value_type>);
glibcpp_function_requires(LessThanComparableConcept<
typename iterator_traits<_InputIter2>::value_type>);
for ( ; __first1 != __last1 && __first2 != __last2 for ( ; __first1 != __last1 && __first2 != __last2
; ++__first1, ++__first2) { ; ++__first1, ++__first2) {
if (*__first1 < *__first2) if (*__first1 < *__first2)
@ -532,9 +588,12 @@ bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
template <class _InputIter1, class _InputIter2, class _Compare> template <class _InputIter1, class _InputIter2, class _Compare>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2, _InputIter2 __first2, _InputIter2 __last2,
_Compare __comp) { _Compare __comp)
__STL_REQUIRES(_InputIter1, _InputIterator); {
__STL_REQUIRES(_InputIter2, _InputIterator); // concept requirements
glibcpp_function_requires(InputIteratorConcept<_InputIter1>);
glibcpp_function_requires(InputIteratorConcept<_InputIter2>);
for ( ; __first1 != __last1 && __first2 != __last2 for ( ; __first1 != __last1 && __first2 != __last2
; ++__first1, ++__first2) { ; ++__first1, ++__first2) {
if (__comp(*__first1, *__first2)) if (__comp(*__first1, *__first2))
@ -628,12 +687,14 @@ template <class _InputIter1, class _InputIter2>
int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2) _InputIter2 __first2, _InputIter2 __last2)
{ {
__STL_REQUIRES(_InputIter1, _InputIterator); // concept requirements
__STL_REQUIRES(_InputIter2, _InputIterator); glibcpp_function_requires(InputIteratorConcept<_InputIter1>);
__STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, glibcpp_function_requires(InputIteratorConcept<_InputIter2>);
_LessThanComparable); glibcpp_function_requires(LessThanComparableConcept<
__STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, typename iterator_traits<_InputIter1>::value_type>);
_LessThanComparable); glibcpp_function_requires(LessThanComparableConcept<
typename iterator_traits<_InputIter2>::value_type>);
return __lexicographical_compare_3way(__first1, __last1, __first2, __last2); return __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
} }

View file

@ -81,7 +81,7 @@ __destroy(_ForwardIterator __first, _ForwardIterator __last, _Tp*)
template <class _ForwardIterator> template <class _ForwardIterator>
inline void _Destroy(_ForwardIterator __first, _ForwardIterator __last) { inline void _Destroy(_ForwardIterator __first, _ForwardIterator __last) {
__destroy(__first, __last, __VALUE_TYPE(__first)); __destroy(__first, __last, __value_type(__first));
} }
inline void _Destroy(char*, char*) {} inline void _Destroy(char*, char*) {}

View file

@ -28,7 +28,9 @@
* You should not attempt to use it directly. * You should not attempt to use it directly.
*/ */
#include <bits/concept_checks.h> #include <bits/concept_check.h>
#include <bits/stl_iterator_base_types.h>
#include <bits/stl_iterator_base_funcs.h>
#ifndef __SGI_STL_INTERNAL_DEQUE_H #ifndef __SGI_STL_INTERNAL_DEQUE_H
#define __SGI_STL_INTERNAL_DEQUE_H #define __SGI_STL_INTERNAL_DEQUE_H
@ -354,9 +356,8 @@ _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish)
template <class _Tp, class _Alloc = allocator<_Tp> > template <class _Tp, class _Alloc = allocator<_Tp> >
class deque : protected _Deque_base<_Tp, _Alloc> { class deque : protected _Deque_base<_Tp, _Alloc> {
// requirements: // concept requirements
glibcpp_class_requires(_Tp, SGIAssignableConcept);
__STL_CLASS_REQUIRES(_Tp, _Assignable);
typedef _Deque_base<_Tp, _Alloc> _Base; typedef _Deque_base<_Tp, _Alloc> _Base;
public: // Basic types public: // Basic types
@ -469,7 +470,7 @@ public: // Constructor, destructor.
template <class _InputIter> template <class _InputIter>
void _M_initialize_dispatch(_InputIter __first, _InputIter __last, void _M_initialize_dispatch(_InputIter __first, _InputIter __last,
__false_type) { __false_type) {
_M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first)); _M_range_initialize(__first, __last, __iterator_category(__first));
} }
~deque() { destroy(_M_start, _M_finish); } ~deque() { destroy(_M_start, _M_finish); }
@ -531,7 +532,7 @@ private: // helper functions for assign()
template <class _InputIterator> template <class _InputIterator>
void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
__false_type) { __false_type) {
_M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); _M_assign_aux(__first, __last, __iterator_category(__first));
} }
template <class _InputIterator> template <class _InputIterator>
@ -653,7 +654,7 @@ public: // Insert
void _M_insert_dispatch(iterator __pos, void _M_insert_dispatch(iterator __pos,
_InputIterator __first, _InputIterator __last, _InputIterator __first, _InputIterator __last,
__false_type) { __false_type) {
insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first)); insert(__pos, __first, __last, __iterator_category(__first));
} }
void resize(size_type __new_size, const value_type& __x) { void resize(size_type __new_size, const value_type& __x) {

View file

@ -62,11 +62,14 @@ template <class _RandomAccessIterator>
inline void inline void
push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ {
__STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); // concept requirements
__STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, glibcpp_function_requires(Mutable_RandomAccessIteratorConcept<
_LessThanComparable); _RandomAccessIterator>);
glibcpp_function_requires(LessThanComparableConcept<
typename iterator_traits<_RandomAccessIterator>::value_type>);
__push_heap_aux(__first, __last, __push_heap_aux(__first, __last,
__DISTANCE_TYPE(__first), __VALUE_TYPE(__first)); __distance_type(__first), __value_type(__first));
} }
template <class _RandomAccessIterator, class _Distance, class _Tp, template <class _RandomAccessIterator, class _Distance, class _Tp,
@ -100,9 +103,12 @@ inline void
push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp) _Compare __comp)
{ {
__STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); // concept requirements
glibcpp_function_requires(Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>);
__push_heap_aux(__first, __last, __comp, __push_heap_aux(__first, __last, __comp,
__DISTANCE_TYPE(__first), __VALUE_TYPE(__first)); __distance_type(__first), __value_type(__first));
} }
template <class _RandomAccessIterator, class _Distance, class _Tp> template <class _RandomAccessIterator, class _Distance, class _Tp>
@ -141,17 +147,20 @@ __pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Tp*) _Tp*)
{ {
__pop_heap(__first, __last - 1, __last - 1, __pop_heap(__first, __last - 1, __last - 1,
_Tp(*(__last - 1)), __DISTANCE_TYPE(__first)); _Tp(*(__last - 1)), __distance_type(__first));
} }
template <class _RandomAccessIterator> template <class _RandomAccessIterator>
inline void pop_heap(_RandomAccessIterator __first, inline void pop_heap(_RandomAccessIterator __first,
_RandomAccessIterator __last) _RandomAccessIterator __last)
{ {
__STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); // concept requirements
__STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, glibcpp_function_requires(Mutable_RandomAccessIteratorConcept<
_LessThanComparable); _RandomAccessIterator>);
__pop_heap_aux(__first, __last, __VALUE_TYPE(__first)); glibcpp_function_requires(LessThanComparableConcept<
typename iterator_traits<_RandomAccessIterator>::value_type>);
__pop_heap_aux(__first, __last, __value_type(__first));
} }
template <class _RandomAccessIterator, class _Distance, template <class _RandomAccessIterator, class _Distance,
@ -194,7 +203,7 @@ __pop_heap_aux(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Tp*, _Compare __comp) _RandomAccessIterator __last, _Tp*, _Compare __comp)
{ {
__pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp, __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp,
__DISTANCE_TYPE(__first)); __distance_type(__first));
} }
template <class _RandomAccessIterator, class _Compare> template <class _RandomAccessIterator, class _Compare>
@ -202,8 +211,11 @@ inline void
pop_heap(_RandomAccessIterator __first, pop_heap(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp) _RandomAccessIterator __last, _Compare __comp)
{ {
__STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); // concept requirements
__pop_heap_aux(__first, __last, __VALUE_TYPE(__first), __comp); glibcpp_function_requires(Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>);
__pop_heap_aux(__first, __last, __value_type(__first), __comp);
} }
template <class _RandomAccessIterator, class _Tp, class _Distance> template <class _RandomAccessIterator, class _Tp, class _Distance>
@ -226,11 +238,14 @@ template <class _RandomAccessIterator>
inline void inline void
make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ {
__STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); // concept requirements
__STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, glibcpp_function_requires(Mutable_RandomAccessIteratorConcept<
_LessThanComparable); _RandomAccessIterator>);
glibcpp_function_requires(LessThanComparableConcept<
typename iterator_traits<_RandomAccessIterator>::value_type>);
__make_heap(__first, __last, __make_heap(__first, __last,
__VALUE_TYPE(__first), __DISTANCE_TYPE(__first)); __value_type(__first), __distance_type(__first));
} }
template <class _RandomAccessIterator, class _Compare, template <class _RandomAccessIterator, class _Compare,
@ -256,17 +271,23 @@ inline void
make_heap(_RandomAccessIterator __first, make_heap(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp) _RandomAccessIterator __last, _Compare __comp)
{ {
__STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); // concept requirements
glibcpp_function_requires(Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>);
__make_heap(__first, __last, __comp, __make_heap(__first, __last, __comp,
__VALUE_TYPE(__first), __DISTANCE_TYPE(__first)); __value_type(__first), __distance_type(__first));
} }
template <class _RandomAccessIterator> template <class _RandomAccessIterator>
void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ {
__STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); // concept requirements
__STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, glibcpp_function_requires(Mutable_RandomAccessIteratorConcept<
_LessThanComparable); _RandomAccessIterator>);
glibcpp_function_requires(LessThanComparableConcept<
typename iterator_traits<_RandomAccessIterator>::value_type>);
while (__last - __first > 1) while (__last - __first > 1)
pop_heap(__first, __last--); pop_heap(__first, __last--);
} }
@ -276,7 +297,10 @@ void
sort_heap(_RandomAccessIterator __first, sort_heap(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp) _RandomAccessIterator __last, _Compare __comp)
{ {
__STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); // concept requirements
glibcpp_function_requires(Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>);
while (__last - __first > 1) while (__last - __first > 1)
pop_heap(__first, __last--, __comp); pop_heap(__first, __last--, __comp);
} }

View file

@ -0,0 +1,152 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996-1998
* 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.
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_FUNCS_H
#define __SGI_STL_INTERNAL_ITERATOR_BASE_FUNCS_H
// This file contains all of the general iterator-related utility
// functions, such as distance() and advance().
// The internal file stl_iterator.h contains predefined iterators,
// such as front_insert_iterator and istream_iterator.
#pragma GCC system_header
#include <bits/concept_check.h>
namespace std
{
// There are two signatures for distance. In addition to the one taking
// two iterators and returning a result, there is another taking two
// iterators and a reference-to-result variable, and returning nothing.
// The latter seems to be an SGI extension. -- pedwards
template <class _InputIterator, class _Distance>
inline void __distance(_InputIterator __first, _InputIterator __last,
_Distance& __n, input_iterator_tag)
{
// concept requirements
glibcpp_function_requires(InputIteratorConcept<_InputIterator>);
while (__first != __last) { ++__first; ++__n; }
}
template <class _RandomAccessIterator, class _Distance>
inline void __distance(_RandomAccessIterator __first,
_RandomAccessIterator __last,
_Distance& __n, random_access_iterator_tag)
{
// concept requirements
glibcpp_function_requires(RandomAccessIteratorConcept<_RandomAccessIterator>);
__n += __last - __first;
}
template <class _InputIterator, class _Distance>
inline void distance(_InputIterator __first,
_InputIterator __last, _Distance& __n)
{
// concept requirements -- taken care of in __distance
__distance(__first, __last, __n, iterator_category(__first));
}
template <class _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type
__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag)
{
// concept requirements
glibcpp_function_requires(InputIteratorConcept<_InputIterator>);
typename iterator_traits<_InputIterator>::difference_type __n = 0;
while (__first != __last) {
++__first; ++__n;
}
return __n;
}
template <class _RandomAccessIterator>
inline typename iterator_traits<_RandomAccessIterator>::difference_type
__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
random_access_iterator_tag)
{
// concept requirements
glibcpp_function_requires(RandomAccessIteratorConcept<_RandomAccessIterator>);
return __last - __first;
}
template <class _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type
distance(_InputIterator __first, _InputIterator __last)
{
// concept requirements -- taken care of in __distance
typedef typename iterator_traits<_InputIterator>::iterator_category
_Category;
return __distance(__first, __last, _Category());
}
template <class _InputIter, class _Distance>
inline void __advance(_InputIter& __i, _Distance __n, input_iterator_tag)
{
// concept requirements
glibcpp_function_requires(InputIteratorConcept<_InputIter>);
while (__n--) ++__i;
}
template <class _BidirectionalIterator, class _Distance>
inline void __advance(_BidirectionalIterator& __i, _Distance __n,
bidirectional_iterator_tag)
{
// concept requirements
glibcpp_function_requires(BidirectionalIteratorConcept<_BidirectionalIterator>);
if (__n >= 0)
while (__n--) ++__i;
else
while (__n++) --__i;
}
template <class _RandomAccessIterator, class _Distance>
inline void __advance(_RandomAccessIterator& __i, _Distance __n,
random_access_iterator_tag)
{
// concept requirements
glibcpp_function_requires(RandomAccessIteratorConcept<_RandomAccessIterator>);
__i += __n;
}
template <class _InputIterator, class _Distance>
inline void advance(_InputIterator& __i, _Distance __n)
{
// concept requirements -- taken care of in __advance
__advance(__i, __n, iterator_category(__i));
}
} // namespace std
#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_FUNCS_H */
// Local Variables:
// mode:C++
// End:

View file

@ -28,14 +28,15 @@
* You should not attempt to use it directly. * You should not attempt to use it directly.
*/ */
#ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_H #ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_TYPES_H
#define __SGI_STL_INTERNAL_ITERATOR_BASE_H #define __SGI_STL_INTERNAL_ITERATOR_BASE_TYPES_H
// This file contains all of the general iterator-related utilities. // This file contains all of the general iterator-related utility
// types, such as iterator_traits and struct iterator.
// The internal file stl_iterator.h contains predefined iterators, // The internal file stl_iterator.h contains predefined iterators,
// such as front_insert_iterator and istream_iterator. // such as front_insert_iterator and istream_iterator.
#include <bits/concept_checks.h> #pragma GCC system header
namespace std namespace std
{ {
@ -171,93 +172,9 @@ template <class _Iter>
inline typename iterator_traits<_Iter>::value_type* inline typename iterator_traits<_Iter>::value_type*
value_type(const _Iter& __i) { return __value_type(__i); } value_type(const _Iter& __i) { return __value_type(__i); }
#define __ITERATOR_CATEGORY(__i) __iterator_category(__i)
#define __DISTANCE_TYPE(__i) __distance_type(__i)
#define __VALUE_TYPE(__i) __value_type(__i)
template <class _InputIterator, class _Distance>
inline void __distance(_InputIterator __first, _InputIterator __last,
_Distance& __n, input_iterator_tag)
{
while (__first != __last) { ++__first; ++__n; }
}
template <class _RandomAccessIterator, class _Distance>
inline void __distance(_RandomAccessIterator __first,
_RandomAccessIterator __last,
_Distance& __n, random_access_iterator_tag)
{
__STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
__n += __last - __first;
}
template <class _InputIterator, class _Distance>
inline void distance(_InputIterator __first,
_InputIterator __last, _Distance& __n)
{
__STL_REQUIRES(_InputIterator, _InputIterator);
__distance(__first, __last, __n, iterator_category(__first));
}
template <class _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type
__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag)
{
typename iterator_traits<_InputIterator>::difference_type __n = 0;
while (__first != __last) {
++__first; ++__n;
}
return __n;
}
template <class _RandomAccessIterator>
inline typename iterator_traits<_RandomAccessIterator>::difference_type
__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
random_access_iterator_tag) {
__STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
return __last - __first;
}
template <class _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type
distance(_InputIterator __first, _InputIterator __last) {
typedef typename iterator_traits<_InputIterator>::iterator_category
_Category;
__STL_REQUIRES(_InputIterator, _InputIterator);
return __distance(__first, __last, _Category());
}
template <class _InputIter, class _Distance>
inline void __advance(_InputIter& __i, _Distance __n, input_iterator_tag) {
while (__n--) ++__i;
}
template <class _BidirectionalIterator, class _Distance>
inline void __advance(_BidirectionalIterator& __i, _Distance __n,
bidirectional_iterator_tag) {
__STL_REQUIRES(_BidirectionalIterator, _BidirectionalIterator);
if (__n >= 0)
while (__n--) ++__i;
else
while (__n++) --__i;
}
template <class _RandomAccessIterator, class _Distance>
inline void __advance(_RandomAccessIterator& __i, _Distance __n,
random_access_iterator_tag) {
__STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
__i += __n;
}
template <class _InputIterator, class _Distance>
inline void advance(_InputIterator& __i, _Distance __n) {
__STL_REQUIRES(_InputIterator, _InputIterator);
__advance(__i, __n, iterator_category(__i));
}
} // namespace std } // namespace std
#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_H */ #endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_TYPES_H */
// Local Variables: // Local Variables:

View file

@ -31,7 +31,7 @@
#ifndef __SGI_STL_INTERNAL_LIST_H #ifndef __SGI_STL_INTERNAL_LIST_H
#define __SGI_STL_INTERNAL_LIST_H #define __SGI_STL_INTERNAL_LIST_H
#include <bits/concept_checks.h> #include <bits/concept_check.h>
namespace std namespace std
{ {
@ -198,10 +198,10 @@ _List_base<_Tp,_Alloc>::clear()
} }
template <class _Tp, class _Alloc = allocator<_Tp> > template <class _Tp, class _Alloc = allocator<_Tp> >
class list : protected _List_base<_Tp, _Alloc> { class list : protected _List_base<_Tp, _Alloc>
// requirements: {
// concept requirements
__STL_CLASS_REQUIRES(_Tp, _Assignable); glibcpp_class_requires(_Tp, SGIAssignableConcept);
typedef _List_base<_Tp, _Alloc> _Base; typedef _List_base<_Tp, _Alloc> _Base;
protected: protected:

View file

@ -31,23 +31,21 @@
#ifndef _CPP_BITS_STL_MAP_H #ifndef _CPP_BITS_STL_MAP_H
#define _CPP_BITS_STL_MAP_H 1 #define _CPP_BITS_STL_MAP_H 1
#include <bits/concept_checks.h> #include <bits/concept_check.h>
namespace std namespace std
{ {
template <class _Key, class _Tp, class _Compare = less<_Key>, template <class _Key, class _Tp, class _Compare = less<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > > class _Alloc = allocator<pair<const _Key, _Tp> > >
class map { class map
{
// concept requirements
glibcpp_class_requires(_Tp, SGIAssignableConcept);
glibcpp_class_requires4(_Compare, bool, _Key, _Key, BinaryFunctionConcept);
public: public:
// typedefs:
// requirements:
__STL_CLASS_REQUIRES(_Tp, _Assignable);
__STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key);
// typedefs:
typedef _Key key_type; typedef _Key key_type;
typedef _Tp data_type; typedef _Tp data_type;
typedef _Tp mapped_type; typedef _Tp mapped_type;

View file

@ -31,7 +31,7 @@
#ifndef __SGI_STL_INTERNAL_MULTIMAP_H #ifndef __SGI_STL_INTERNAL_MULTIMAP_H
#define __SGI_STL_INTERNAL_MULTIMAP_H #define __SGI_STL_INTERNAL_MULTIMAP_H
#include <bits/concept_checks.h> #include <bits/concept_check.h>
namespace std namespace std
{ {
@ -52,11 +52,11 @@ inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y); const multimap<_Key,_Tp,_Compare,_Alloc>& __y);
template <class _Key, class _Tp, class _Compare, class _Alloc> template <class _Key, class _Tp, class _Compare, class _Alloc>
class multimap { class multimap
// requirements: {
// concept requirements
__STL_CLASS_REQUIRES(_Tp, _Assignable); glibcpp_class_requires(_Tp, SGIAssignableConcept);
__STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); glibcpp_class_requires4(_Compare, bool, _Key, _Key, BinaryFunctionConcept);
public: public:

View file

@ -31,7 +31,7 @@
#ifndef __SGI_STL_INTERNAL_MULTISET_H #ifndef __SGI_STL_INTERNAL_MULTISET_H
#define __SGI_STL_INTERNAL_MULTISET_H #define __SGI_STL_INTERNAL_MULTISET_H
#include <bits/concept_checks.h> #include <bits/concept_check.h>
namespace std namespace std
{ {
@ -51,11 +51,11 @@ inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y); const multiset<_Key,_Compare,_Alloc>& __y);
template <class _Key, class _Compare, class _Alloc> template <class _Key, class _Compare, class _Alloc>
class multiset { class multiset
// requirements: {
// concept requirements
__STL_CLASS_REQUIRES(_Key, _Assignable); glibcpp_class_requires(_Key, SGIAssignableConcept);
__STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); glibcpp_class_requires4(_Compare, bool, _Key, _Key, BinaryFunctionConcept);
public: public:

View file

@ -38,7 +38,9 @@ namespace std
template <class _InputIterator, class _Tp> template <class _InputIterator, class _Tp>
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
{ {
__STL_REQUIRES(_InputIterator, _InputIterator); // concept requirements
glibcpp_function_requires(InputIteratorConcept<_InputIterator>);
for ( ; __first != __last; ++__first) for ( ; __first != __last; ++__first)
__init = __init + *__first; __init = __init + *__first;
return __init; return __init;
@ -48,7 +50,9 @@ template <class _InputIterator, class _Tp, class _BinaryOperation>
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
_BinaryOperation __binary_op) _BinaryOperation __binary_op)
{ {
__STL_REQUIRES(_InputIterator, _InputIterator); // concept requirements
glibcpp_function_requires(InputIteratorConcept<_InputIterator>);
for ( ; __first != __last; ++__first) for ( ; __first != __last; ++__first)
__init = __binary_op(__init, *__first); __init = __binary_op(__init, *__first);
return __init; return __init;
@ -58,8 +62,10 @@ template <class _InputIterator1, class _InputIterator2, class _Tp>
_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _Tp __init) _InputIterator2 __first2, _Tp __init)
{ {
__STL_REQUIRES(_InputIterator2, _InputIterator); // concept requirements
__STL_REQUIRES(_InputIterator2, _InputIterator); glibcpp_function_requires(InputIteratorConcept<_InputIterator1>);
glibcpp_function_requires(InputIteratorConcept<_InputIterator2>);
for ( ; __first1 != __last1; ++__first1, ++__first2) for ( ; __first1 != __last1; ++__first1, ++__first2)
__init = __init + (*__first1 * *__first2); __init = __init + (*__first1 * *__first2);
return __init; return __init;
@ -72,8 +78,10 @@ _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
_BinaryOperation1 __binary_op1, _BinaryOperation1 __binary_op1,
_BinaryOperation2 __binary_op2) _BinaryOperation2 __binary_op2)
{ {
__STL_REQUIRES(_InputIterator2, _InputIterator); // concept requirements
__STL_REQUIRES(_InputIterator2, _InputIterator); glibcpp_function_requires(InputIteratorConcept<_InputIterator1>);
glibcpp_function_requires(InputIteratorConcept<_InputIterator2>);
for ( ; __first1 != __last1; ++__first1, ++__first2) for ( ; __first1 != __last1; ++__first1, ++__first2)
__init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
return __init; return __init;
@ -97,11 +105,14 @@ _OutputIterator
partial_sum(_InputIterator __first, _InputIterator __last, partial_sum(_InputIterator __first, _InputIterator __last,
_OutputIterator __result) _OutputIterator __result)
{ {
__STL_REQUIRES(_InputIterator, _InputIterator); // concept requirements
__STL_REQUIRES(_OutputIterator, _OutputIterator); glibcpp_function_requires(InputIteratorConcept<_InputIterator>);
glibcpp_function_requires(OutputIteratorConcept<_OutputIterator,
typename iterator_traits<_InputIterator>::value_type>);
if (__first == __last) return __result; if (__first == __last) return __result;
*__result = *__first; *__result = *__first;
return __partial_sum(__first, __last, __result, __VALUE_TYPE(__first)); return __partial_sum(__first, __last, __result, __value_type(__first));
} }
template <class _InputIterator, class _OutputIterator, class _Tp, template <class _InputIterator, class _OutputIterator, class _Tp,
@ -123,11 +134,14 @@ _OutputIterator
partial_sum(_InputIterator __first, _InputIterator __last, partial_sum(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _BinaryOperation __binary_op) _OutputIterator __result, _BinaryOperation __binary_op)
{ {
__STL_REQUIRES(_InputIterator, _InputIterator); // concept requirements
__STL_REQUIRES(_OutputIterator, _OutputIterator); glibcpp_function_requires(InputIteratorConcept<_InputIterator>);
glibcpp_function_requires(OutputIteratorConcept<_OutputIterator,
typename iterator_traits<_InputIterator>::value_type>);
if (__first == __last) return __result; if (__first == __last) return __result;
*__result = *__first; *__result = *__first;
return __partial_sum(__first, __last, __result, __VALUE_TYPE(__first), return __partial_sum(__first, __last, __result, __value_type(__first),
__binary_op); __binary_op);
} }
@ -150,12 +164,15 @@ _OutputIterator
adjacent_difference(_InputIterator __first, adjacent_difference(_InputIterator __first,
_InputIterator __last, _OutputIterator __result) _InputIterator __last, _OutputIterator __result)
{ {
__STL_REQUIRES(_InputIterator, _InputIterator); // concept requirements
__STL_REQUIRES(_OutputIterator, _OutputIterator); glibcpp_function_requires(InputIteratorConcept<_InputIterator>);
glibcpp_function_requires(OutputIteratorConcept<_OutputIterator,
typename iterator_traits<_InputIterator>::value_type>);
if (__first == __last) return __result; if (__first == __last) return __result;
*__result = *__first; *__result = *__first;
return __adjacent_difference(__first, __last, __result, return __adjacent_difference(__first, __last, __result,
__VALUE_TYPE(__first)); __value_type(__first));
} }
template <class _InputIterator, class _OutputIterator, class _Tp, template <class _InputIterator, class _OutputIterator, class _Tp,
@ -178,12 +195,15 @@ _OutputIterator
adjacent_difference(_InputIterator __first, _InputIterator __last, adjacent_difference(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _BinaryOperation __binary_op) _OutputIterator __result, _BinaryOperation __binary_op)
{ {
__STL_REQUIRES(_InputIterator, _InputIterator); // concept requirements
__STL_REQUIRES(_OutputIterator, _OutputIterator); glibcpp_function_requires(InputIteratorConcept<_InputIterator>);
glibcpp_function_requires(OutputIteratorConcept<_OutputIterator,
typename iterator_traits<_InputIterator>::value_type>);
if (__first == __last) return __result; if (__first == __last) return __result;
*__result = *__first; *__result = *__first;
return __adjacent_difference(__first, __last, __result, return __adjacent_difference(__first, __last, __result,
__VALUE_TYPE(__first), __value_type(__first),
__binary_op); __binary_op);
} }
@ -241,8 +261,11 @@ template <class _ForwardIter, class _Tp>
void void
iota(_ForwardIter __first, _ForwardIter __last, _Tp __value) iota(_ForwardIter __first, _ForwardIter __last, _Tp __value)
{ {
__STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); // concept requirements
__STL_CONVERTIBLE(_Tp, typename iterator_traits<_ForwardIter>::value_type); glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>);
glibcpp_function_requires(ConvertibleConcept<_Tp,
typename iterator_traits<_ForwardIter>::value_type>);
while (__first != __last) while (__first != __last)
*__first++ = __value++; *__first++ = __value++;
} }

View file

@ -31,7 +31,7 @@
#ifndef __SGI_STL_INTERNAL_QUEUE_H #ifndef __SGI_STL_INTERNAL_QUEUE_H
#define __SGI_STL_INTERNAL_QUEUE_H #define __SGI_STL_INTERNAL_QUEUE_H
#include <bits/sequence_concepts.h> #include <bits/concept_check.h>
namespace std namespace std
{ {
@ -50,16 +50,14 @@ inline bool operator<(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&);
template <class _Tp, class _Sequence> template <class _Tp, class _Sequence>
class queue { class queue
{
// requirements: // concept requirements
glibcpp_class_requires(_Tp, SGIAssignableConcept);
__STL_CLASS_REQUIRES(_Tp, _Assignable); glibcpp_class_requires(_Sequence, FrontInsertionSequenceConcept);
__STL_CLASS_REQUIRES(_Sequence, _FrontInsertionSequence); glibcpp_class_requires(_Sequence, BackInsertionSequenceConcept);
__STL_CLASS_REQUIRES(_Sequence, _BackInsertionSequence);
typedef typename _Sequence::value_type _Sequence_value_type; typedef typename _Sequence::value_type _Sequence_value_type;
__STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type); glibcpp_class_requires2(_Tp, _Sequence_value_type, SameTypeConcept);
template <class _Tp1, class _Seq1> template <class _Tp1, class _Seq1>
friend bool operator== (const queue<_Tp1, _Seq1>&, friend bool operator== (const queue<_Tp1, _Seq1>&,
@ -135,17 +133,17 @@ operator>=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
template <class _Tp, template <class _Tp,
class _Sequence = vector<_Tp>, class _Sequence = vector<_Tp>,
class _Compare = less<typename _Sequence::value_type> > class _Compare = less<typename _Sequence::value_type> >
class priority_queue { class priority_queue
public: {
// concept requirements
// requirements: glibcpp_class_requires(_Tp, SGIAssignableConcept);
__STL_CLASS_REQUIRES(_Tp, _Assignable); glibcpp_class_requires(_Sequence, SequenceConcept);
__STL_CLASS_REQUIRES(_Sequence, _Sequence); glibcpp_class_requires(_Sequence, RandomAccessContainerConcept);
__STL_CLASS_REQUIRES(_Sequence, _RandomAccessContainer);
typedef typename _Sequence::value_type _Sequence_value_type; typedef typename _Sequence::value_type _Sequence_value_type;
__STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type); glibcpp_class_requires2(_Tp, _Sequence_value_type, SameTypeConcept);
__STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); glibcpp_class_requires4(_Compare, bool, _Tp, _Tp, BinaryFunctionConcept);
public:
typedef typename _Sequence::value_type value_type; typedef typename _Sequence::value_type value_type;
typedef typename _Sequence::size_type size_type; typedef typename _Sequence::size_type size_type;
typedef _Sequence container_type; typedef _Sequence container_type;

View file

@ -31,7 +31,7 @@
#ifndef __SGI_STL_INTERNAL_SET_H #ifndef __SGI_STL_INTERNAL_SET_H
#define __SGI_STL_INTERNAL_SET_H #define __SGI_STL_INTERNAL_SET_H
#include <bits/concept_checks.h> #include <bits/concept_check.h>
namespace std namespace std
{ {
@ -52,15 +52,14 @@ inline bool operator<(const set<_Key,_Compare,_Alloc>& __x,
template <class _Key, class _Compare, class _Alloc> template <class _Key, class _Compare, class _Alloc>
class set { class set
// requirements: {
// concept requirements
__STL_CLASS_REQUIRES(_Key, _Assignable); glibcpp_class_requires(_Key, SGIAssignableConcept);
__STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); glibcpp_class_requires4(_Compare, bool, _Key, _Key, BinaryFunctionConcept);
public: public:
// typedefs: // typedefs:
typedef _Key key_type; typedef _Key key_type;
typedef _Key value_type; typedef _Key value_type;
typedef _Compare key_compare; typedef _Compare key_compare;

View file

@ -31,7 +31,7 @@
#ifndef __SGI_STL_INTERNAL_STACK_H #ifndef __SGI_STL_INTERNAL_STACK_H
#define __SGI_STL_INTERNAL_STACK_H #define __SGI_STL_INTERNAL_STACK_H
#include <bits/sequence_concepts.h> #include <bits/concept_check.h>
namespace std namespace std
{ {
@ -50,15 +50,13 @@ bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y);
template <class _Tp, class _Sequence> template <class _Tp, class _Sequence>
class stack { class stack
{
// requirements: // concept requirements
glibcpp_class_requires(_Tp, SGIAssignableConcept);
__STL_CLASS_REQUIRES(_Tp, _Assignable); glibcpp_class_requires(_Sequence, BackInsertionSequenceConcept);
__STL_CLASS_REQUIRES(_Sequence, _BackInsertionSequence);
typedef typename _Sequence::value_type _Sequence_value_type; typedef typename _Sequence::value_type _Sequence_value_type;
__STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type); glibcpp_class_requires2(_Tp, _Sequence_value_type, SameTypeConcept);
template <class _Tp1, class _Seq1> template <class _Tp1, class _Seq1>
friend bool operator== (const stack<_Tp1, _Seq1>&, friend bool operator== (const stack<_Tp1, _Seq1>&,

View file

@ -80,7 +80,7 @@ inline _ForwardIter
_ForwardIter __result) _ForwardIter __result)
{ {
return __uninitialized_copy(__first, __last, __result, return __uninitialized_copy(__first, __last, __result,
__VALUE_TYPE(__result)); __value_type(__result));
} }
inline char* uninitialized_copy(const char* __first, const char* __last, inline char* uninitialized_copy(const char* __first, const char* __last,
@ -130,7 +130,7 @@ inline pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count, __uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result) { _ForwardIter __result) {
return __uninitialized_copy_n(__first, __count, __result, return __uninitialized_copy_n(__first, __count, __result,
__ITERATOR_CATEGORY(__first)); __iterator_category(__first));
} }
template <class _InputIter, class _Size, class _ForwardIter> template <class _InputIter, class _Size, class _ForwardIter>
@ -138,7 +138,7 @@ inline pair<_InputIter, _ForwardIter>
uninitialized_copy_n(_InputIter __first, _Size __count, uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result) { _ForwardIter __result) {
return __uninitialized_copy_n(__first, __count, __result, return __uninitialized_copy_n(__first, __count, __result,
__ITERATOR_CATEGORY(__first)); __iterator_category(__first));
} }
// Valid if copy construction is equivalent to assignment, and if the // Valid if copy construction is equivalent to assignment, and if the
@ -178,7 +178,7 @@ inline void uninitialized_fill(_ForwardIter __first,
_ForwardIter __last, _ForwardIter __last,
const _Tp& __x) const _Tp& __x)
{ {
__uninitialized_fill(__first, __last, __x, __VALUE_TYPE(__first)); __uninitialized_fill(__first, __last, __x, __value_type(__first));
} }
// Valid if copy construction is equivalent to assignment, and if the // Valid if copy construction is equivalent to assignment, and if the
@ -217,7 +217,7 @@ template <class _ForwardIter, class _Size, class _Tp>
inline _ForwardIter inline _ForwardIter
uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x)
{ {
return __uninitialized_fill_n(__first, __n, __x, __VALUE_TYPE(__first)); return __uninitialized_fill_n(__first, __n, __x, __value_type(__first));
} }
// Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill, // Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill,

View file

@ -31,8 +31,9 @@
#ifndef __SGI_STL_INTERNAL_VECTOR_H #ifndef __SGI_STL_INTERNAL_VECTOR_H
#define __SGI_STL_INTERNAL_VECTOR_H #define __SGI_STL_INTERNAL_VECTOR_H
#include <bits/stl_iterator_base_funcs.h>
#include <bits/functexcept.h> #include <bits/functexcept.h>
#include <bits/concept_checks.h> #include <bits/concept_check.h>
namespace std namespace std
{ {
@ -116,9 +117,8 @@ struct _Vector_base
template <class _Tp, class _Alloc = allocator<_Tp> > template <class _Tp, class _Alloc = allocator<_Tp> >
class vector : protected _Vector_base<_Tp, _Alloc> class vector : protected _Vector_base<_Tp, _Alloc>
{ {
// requirements: // concept requirements
glibcpp_class_requires(_Tp, SGIAssignableConcept);
__STL_CLASS_REQUIRES(_Tp, _Assignable);
private: private:
typedef _Vector_base<_Tp, _Alloc> _Base; typedef _Vector_base<_Tp, _Alloc> _Base;
@ -223,7 +223,7 @@ public:
template <class _InputIterator> template <class _InputIterator>
void _M_initialize_aux(_InputIterator __first, _InputIterator __last, void _M_initialize_aux(_InputIterator __first, _InputIterator __last,
__false_type) { __false_type) {
_M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first)); _M_range_initialize(__first, __last, __iterator_category(__first));
} }
~vector() { destroy(_M_start, _M_finish); } ~vector() { destroy(_M_start, _M_finish); }
@ -261,7 +261,7 @@ public:
template <class _InputIter> template <class _InputIter>
void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type) void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
{ _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); } { _M_assign_aux(__first, __last, __iterator_category(__first)); }
template <class _InputIterator> template <class _InputIterator>
void _M_assign_aux(_InputIterator __first, _InputIterator __last, void _M_assign_aux(_InputIterator __first, _InputIterator __last,
@ -334,7 +334,7 @@ public:
void _M_insert_dispatch(iterator __pos, void _M_insert_dispatch(iterator __pos,
_InputIterator __first, _InputIterator __last, _InputIterator __first, _InputIterator __last,
__false_type) { __false_type) {
_M_range_insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first)); _M_range_insert(__pos, __first, __last, __iterator_category(__first));
} }
void insert (iterator __pos, size_type __n, const _Tp& __x) void insert (iterator __pos, size_type __n, const _Tp& __x)

View file

@ -32,6 +32,7 @@
#define __SGI_STL_INTERNAL_HASH_MAP_H #define __SGI_STL_INTERNAL_HASH_MAP_H
#include <ext/stl_hashtable.h> #include <ext/stl_hashtable.h>
#include <bits/concept_check.h>
namespace std namespace std
{ {
@ -121,8 +122,6 @@ public:
friend bool operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&, friend bool operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&,
const hash_map<_K1, _T1, _HF, _EqK, _Al>&); const hash_map<_K1, _T1, _HF, _EqK, _Al>&);
#include <bits/concept_checks.h>
iterator begin() { return _M_ht.begin(); } iterator begin() { return _M_ht.begin(); }
iterator end() { return _M_ht.end(); } iterator end() { return _M_ht.end(); }
const_iterator begin() const { return _M_ht.begin(); } const_iterator begin() const { return _M_ht.begin(); }
@ -204,11 +203,11 @@ operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
template <class _Key, class _Tp, class _HashFcn, class _EqualKey, class _Alloc> template <class _Key, class _Tp, class _HashFcn, class _EqualKey, class _Alloc>
class hash_multimap class hash_multimap
{ {
// requirements: // concept requirements
__STL_CLASS_REQUIRES(_Key, _Assignable); glibcpp_class_requires(_Key, SGIAssignableConcept);
__STL_CLASS_REQUIRES(_Tp, _Assignable); glibcpp_class_requires(_Tp, SGIAssignableConcept);
__STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Key); glibcpp_class_requires3(_HashFcn, size_t, _Key, UnaryFunctionConcept);
__STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Key, _Key); glibcpp_class_requires3(_EqualKey, _Key, _Key, BinaryPredicateConcept);
private: private:
typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFcn, typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFcn,

View file

@ -32,8 +32,7 @@
#define __SGI_STL_INTERNAL_HASH_SET_H #define __SGI_STL_INTERNAL_HASH_SET_H
#include <ext/stl_hashtable.h> #include <ext/stl_hashtable.h>
#include <bits/concept_check.h>
#include <bits/concept_checks.h>
namespace std namespace std
{ {
@ -54,11 +53,10 @@ operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class hash_set class hash_set
{ {
// requirements: // concept requirements
glibcpp_class_requires(_Value, SGIAssignableConcept);
__STL_CLASS_REQUIRES(_Value, _Assignable); glibcpp_class_requires3(_HashFcn, size_t, _Value, UnaryFunctionConcept);
__STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Value); glibcpp_class_requires3(_EqualKey, _Value, _Value, BinaryPredicateConcept);
__STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Value, _Value);
private: private:
typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
@ -206,11 +204,10 @@ operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class hash_multiset class hash_multiset
{ {
// requirements: // concept requirements
glibcpp_class_requires(_Value, SGIAssignableConcept);
__STL_CLASS_REQUIRES(_Value, _Assignable); glibcpp_class_requires3(_HashFcn, size_t, _Value, UnaryFunctionConcept);
__STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Value); glibcpp_class_requires3(_EqualKey, _Value, _Value, BinaryPredicateConcept);
__STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Value, _Value);
private: private:
typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,

View file

@ -19,7 +19,7 @@
#ifndef __SGI_STL_INTERNAL_SLIST_H #ifndef __SGI_STL_INTERNAL_SLIST_H
#define __SGI_STL_INTERNAL_SLIST_H #define __SGI_STL_INTERNAL_SLIST_H
#include <bits/concept_checks.h> #include <bits/concept_check.h>
namespace std namespace std
{ {
@ -257,9 +257,8 @@ _Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first,
template <class _Tp, class _Alloc = allocator<_Tp> > template <class _Tp, class _Alloc = allocator<_Tp> >
class slist : private _Slist_base<_Tp,_Alloc> class slist : private _Slist_base<_Tp,_Alloc>
{ {
// requirements: // concept requirements
glibcpp_class_requires(_Tp, SGIAssignableConcept);
__STL_CLASS_REQUIRES(_Tp, _Assignable);
private: private:
typedef _Slist_base<_Tp,_Alloc> _Base; typedef _Slist_base<_Tp,_Alloc> _Base;

View file

@ -353,13 +353,13 @@ public:
template <class _InputIterator> template <class _InputIterator>
void insert_unique(_InputIterator __f, _InputIterator __l) void insert_unique(_InputIterator __f, _InputIterator __l)
{ {
insert_unique(__f, __l, __ITERATOR_CATEGORY(__f)); insert_unique(__f, __l, __iterator_category(__f));
} }
template <class _InputIterator> template <class _InputIterator>
void insert_equal(_InputIterator __f, _InputIterator __l) void insert_equal(_InputIterator __f, _InputIterator __l)
{ {
insert_equal(__f, __l, __ITERATOR_CATEGORY(__f)); insert_equal(__f, __l, __iterator_category(__f));
} }
template <class _InputIterator> template <class _InputIterator>

View file

@ -111,7 +111,7 @@ xcompiling = @xcompiling@
AUTOMAKE_OPTIONS = 1.3 cygnus AUTOMAKE_OPTIONS = 1.3 cygnus
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
@GLIBCPP_BUILD_LIBIO_TRUE@noinst_LTLIBRARIES = libio.la @GLIBCPP_BUILD_LIBIO_TRUE@noinst_LTLIBRARIES = @GLIBCPP_BUILD_LIBIO_TRUE@libio.la
@GLIBCPP_BUILD_LIBIO_FALSE@noinst_LTLIBRARIES = @GLIBCPP_BUILD_LIBIO_FALSE@noinst_LTLIBRARIES =
# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
@ -123,14 +123,21 @@ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
LIBIO_INCLUDES = @LIBIO_INCLUDES@ LIBIO_INCLUDES = @LIBIO_INCLUDES@
CSHADOW_INCLUDES = @CSHADOW_INCLUDES@ CSHADOW_INCLUDES = @CSHADOW_INCLUDES@
INCLUDES = -nostdinc++ -I$(top_builddir)/include -I$(GLIBCPP_INCLUDE_DIR) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES) INCLUDES = \
-nostdinc++ \
-I$(top_builddir)/include -I$(GLIBCPP_INCLUDE_DIR) \
$(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
libio_headers = libio.h libioP.h iolibio.h libio_headers = \
libio.h libioP.h iolibio.h
@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_SRCS = filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c iofclose.c iofopen.c @GLIBCPP_NEED_LIBIO_TRUE@LIBIO_SRCS = @GLIBCPP_NEED_LIBIO_TRUE@\
@GLIBCPP_NEED_LIBIO_TRUE@ filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c \
@GLIBCPP_NEED_LIBIO_TRUE@ iofclose.c iofopen.c
@GLIBCPP_NEED_LIBIO_FALSE@LIBIO_SRCS = @GLIBCPP_NEED_LIBIO_FALSE@LIBIO_SRCS =
@GLIBCPP_NEED_WLIBIO_TRUE@LIBIO_WSRCS = wfiledoalloc.c wfileops.c wgenops.c iofwide.c @GLIBCPP_NEED_WLIBIO_TRUE@LIBIO_WSRCS = @GLIBCPP_NEED_WLIBIO_TRUE@\
@GLIBCPP_NEED_WLIBIO_TRUE@ wfiledoalloc.c wfileops.c wgenops.c iofwide.c
@GLIBCPP_NEED_WLIBIO_FALSE@LIBIO_WSRCS = @GLIBCPP_NEED_WLIBIO_FALSE@LIBIO_WSRCS =
EXTRA_DIST = iostreamP.h EXTRA_DIST = iostreamP.h

View file

@ -114,18 +114,24 @@ mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
noinst_LTLIBRARIES = libmath.la noinst_LTLIBRARIES = libmath.la
EXTRA_LONG_DOUBLE_yes = hypotl.c signbitl.c EXTRA_LONG_DOUBLE_yes = \
hypotl.c signbitl.c
EXTRA_DIST = hypot.c hypotf.c atan2f.c expf.c $(EXTRA_LONG_DOUBLE_yes) EXTRA_DIST = \
hypot.c hypotf.c atan2f.c expf.c \
$(EXTRA_LONG_DOUBLE_yes)
libmath_la_LIBADD = @LIBMATHOBJS@ $(EXTRA_LONG_DOUBLE_$(USE_COMPLEX_LONG_DOUBLE)) libmath_la_LIBADD = \
@LIBMATHOBJS@ \
$(EXTRA_LONG_DOUBLE_$(USE_COMPLEX_LONG_DOUBLE))
libmath_la_DEPENDENCIES = $(libmath_la_LIBADD) libmath_la_DEPENDENCIES = $(libmath_la_LIBADD)
libmath_la_SOURCES = signbit.c signbitf.c libmath_la_SOURCES = \
signbit.c signbitf.c
LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
@ -139,7 +145,9 @@ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
LIBIO_INCLUDES = @LIBIO_INCLUDES@ LIBIO_INCLUDES = @LIBIO_INCLUDES@
CSHADOW_INCLUDES = @CSHADOW_INCLUDES@ CSHADOW_INCLUDES = @CSHADOW_INCLUDES@
INCLUDES = -I$(GLIBCPP_INCLUDE_DIR) -I$(top_builddir)/include $(TOPLEVEL_INCLUDES) INCLUDES = \
-I$(GLIBCPP_INCLUDE_DIR) -I$(top_builddir)/include \
$(TOPLEVEL_INCLUDES)
CONFIG_HEADER = ../config.h CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =

View file

@ -129,11 +129,13 @@ OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
# These bits are all figured out from configure. Look in acinclude.m4 # These bits are all figured out from configure. Look in acinclude.m4
# or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS # or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden. # NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
CONFIG_CXXFLAGS = @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@ CONFIG_CXXFLAGS = \
@EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@
# Warning flags to use. # Warning flags to use.
WARN_CXXFLAGS = @WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once WARN_CXXFLAGS = \
@WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
@ -145,13 +147,38 @@ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
LIBIO_INCLUDES = @LIBIO_INCLUDES@ LIBIO_INCLUDES = @LIBIO_INCLUDES@
TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
INCLUDES = -I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include -I$(GLIBCPP_INCLUDE_DIR) $(CSTD_INCLUDES) -I$(top_builddir)/include $(LIBSUPCXX_INCLUDES) INCLUDES = \
-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include \
-I$(GLIBCPP_INCLUDE_DIR) $(CSTD_INCLUDES) -I$(top_builddir)/include \
$(LIBSUPCXX_INCLUDES)
headers = exception new typeinfo cxxabi.h exception_defines.h headers = \
exception new typeinfo cxxabi.h exception_defines.h
sources = del_op.cc del_opnt.cc del_opv.cc del_opvnt.cc eh_alloc.cc eh_aux_runtime.cc eh_catch.cc eh_exception.cc eh_globals.cc eh_personality.cc eh_terminate.cc eh_throw.cc new_handler.cc new_op.cc new_opnt.cc new_opv.cc new_opvnt.cc pure.cc tinfo.cc tinfo2.cc vec.cc sources = \
del_op.cc \
del_opnt.cc \
del_opv.cc \
del_opvnt.cc \
eh_alloc.cc \
eh_aux_runtime.cc \
eh_catch.cc \
eh_exception.cc \
eh_globals.cc \
eh_personality.cc \
eh_terminate.cc \
eh_throw.cc \
new_handler.cc \
new_op.cc \
new_opnt.cc \
new_opv.cc \
new_opvnt.cc \
pure.cc \
tinfo.cc \
tinfo2.cc \
vec.cc
libsupc___la_SOURCES = $(sources) libsupc___la_SOURCES = $(sources)
@ -167,7 +194,12 @@ LIBSUPCXX_CXXFLAGS = -prefer-pic
# set this option because CONFIG_CXXFLAGS has to be after # set this option because CONFIG_CXXFLAGS has to be after
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
# as the occasion call for it. (ie, --enable-debug) # as the occasion call for it. (ie, --enable-debug)
AM_CXXFLAGS = -fno-implicit-templates $(LIBSUPCXX_CXXFLAGS) $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) AM_CXXFLAGS = \
-fno-implicit-templates \
$(LIBSUPCXX_CXXFLAGS) \
$(WARN_CXXFLAGS) \
$(OPTIMIZE_CXXFLAGS) \
$(CONFIG_CXXFLAGS)
# libstdc++ libtool notes # libstdc++ libtool notes
@ -191,7 +223,9 @@ AM_CXXFLAGS = -fno-implicit-templates $(LIBSUPCXX_CXXFLAGS) $(WARN_CXXFLAGS)
# #
# We have to put --tag disable-shared after --tag CXX lest things # We have to put --tag disable-shared after --tag CXX lest things
# CXX undo the affect of disable-shared. # CXX undo the affect of disable-shared.
LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared --mode=compile $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
--mode=compile $(CXX) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
# 3) We'd have a problem when building the shared libstdc++ object if # 3) We'd have a problem when building the shared libstdc++ object if
@ -200,7 +234,9 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared --mode=c
# course is problematic at this point. So, we get the top-level # course is problematic at this point. So, we get the top-level
# directory to configure libstdc++-v3 to use gcc as the C++ # directory to configure libstdc++-v3 to use gcc as the C++
# compilation driver. # compilation driver.
CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared --mode=link $(CXX) @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@ CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
--mode=link $(CXX) \
@OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
CONFIG_HEADER = ../config.h CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =

View file

@ -21,7 +21,7 @@
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA. ## USA.
## $Id: Makefile.am,v 1.79 2001/03/28 01:19:42 aoliva Exp $ ## $Id: Makefile.am,v 1.80 2001/03/31 20:15:43 bkoz Exp $
AUTOMAKE_OPTIONS = 1.3 gnits AUTOMAKE_OPTIONS = 1.3 gnits
MAINT_CHARSET = latin1 MAINT_CHARSET = latin1
@ -80,7 +80,8 @@ base_headers = \
bits/streambuf.tcc bits/basic_file.h \ bits/streambuf.tcc bits/basic_file.h \
bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \ bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \
bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \ bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \
bits/stl_threads.h bits/stl_iterator_base.h \ bits/stl_threads.h \
bits/stl_iterator_base_types.h bits/stl_iterator_base_funcs.h \
bits/std_bitset.h bits/std_deque.h bits/std_functional.h \ bits/std_bitset.h bits/std_deque.h bits/std_functional.h \
bits/std_iterator.h bits/std_list.h \ bits/std_iterator.h bits/std_list.h \
bits/std_map.h bits/std_memory.h bits/std_numeric.h \ bits/std_map.h bits/std_memory.h bits/std_numeric.h \
@ -91,12 +92,11 @@ base_headers = \
bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \ bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \
bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \ bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \
bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \ bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \
bits/stl_relops.h bits/stl_set.h \ bits/stl_relops.h bits/stl_set.h bits/stl_stack.h bits/stl_tempbuf.h \
bits/stl_stack.h bits/stl_tempbuf.h \
bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \ bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \
bits/stl_bvector.h bits/type_traits.h bits/std_algorithm.h \ bits/stl_bvector.h bits/type_traits.h bits/std_algorithm.h \
bits/concept_checks.h bits/container_concepts.h \ bits/stl_construct.h bits/boost_concept_check.h bits/concept_check.h
bits/sequence_concepts.h bits/stl_construct.h
backward_headers = \ backward_headers = \
backward/complex.h backward/iomanip.h backward/istream.h \ backward/complex.h backward/iomanip.h backward/istream.h \
@ -299,8 +299,12 @@ tmp-libstdc++.INC: Makefile
# set this option because CONFIG_CXXFLAGS has to be after # set this option because CONFIG_CXXFLAGS has to be after
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
# as the occasion call for it. (ie, --enable-debug) # as the occasion call for it. (ie, --enable-debug)
#
# The no-implicit-templates flag will generate unresolved references to
# the concept-checking symbols. So we must disable the checks while
# actually building the library.
AM_CXXFLAGS = \ AM_CXXFLAGS = \
-fno-implicit-templates \ -fno-implicit-templates -D_GLIBCPP_NO_CONCEPT_CHECKS \
$(LIBSUPCXX_CXXFLAGS) \ $(LIBSUPCXX_CXXFLAGS) \
$(WARN_CXXFLAGS) \ $(WARN_CXXFLAGS) \
$(OPTIMIZE_CXXFLAGS) \ $(OPTIMIZE_CXXFLAGS) \

View file

@ -121,11 +121,13 @@ OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
# These bits are all figured out from configure. Look in acinclude.m4 # These bits are all figured out from configure. Look in acinclude.m4
# or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS # or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden. # NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
CONFIG_CXXFLAGS = @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@ CONFIG_CXXFLAGS = \
@EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@
# Warning flags to use. # Warning flags to use.
WARN_CXXFLAGS = @WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once WARN_CXXFLAGS = \
@WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
@ -137,44 +139,132 @@ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
LIBIO_INCLUDES = @LIBIO_INCLUDES@ LIBIO_INCLUDES = @LIBIO_INCLUDES@
TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
INCLUDES = -nostdinc++ -I$(GLIBCPP_INCLUDE_DIR) $(CSTD_INCLUDES) -I$(top_builddir)/include $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) $(TOPLEVEL_INCLUDES) INCLUDES = \
-nostdinc++ \
-I$(GLIBCPP_INCLUDE_DIR) $(CSTD_INCLUDES) -I$(top_builddir)/include \
$(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
$(TOPLEVEL_INCLUDES)
base_headers = bits/cpp_type_traits.h bits/char_traits.h bits/codecvt.h bits/stringfwd.h bits/std_string.h bits/basic_string.h bits/basic_string.tcc bits/generic_shadow.h bits/std_utility.h bits/std_complex.h bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h bits/gslice.h bits/gslice_array.h bits/indirect_array.h bits/std_fstream.h bits/std_iomanip.h bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h bits/std_istream.h bits/istream.tcc bits/std_locale.h bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h bits/streambuf.tcc bits/basic_file.h bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h bits/stl_pthread_alloc.h bits/pthread_allocimpl.h bits/stl_threads.h bits/stl_iterator_base.h bits/std_bitset.h bits/std_deque.h bits/std_functional.h bits/std_iterator.h bits/std_list.h bits/std_map.h bits/std_memory.h bits/std_numeric.h bits/std_queue.h bits/std_set.h bits/std_stack.h bits/std_stdexcept.h bits/functexcept.h bits/std_vector.h bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h bits/stl_deque.h bits/stl_function.h bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h bits/stl_relops.h bits/stl_set.h bits/stl_stack.h bits/stl_tempbuf.h bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h bits/stl_bvector.h bits/type_traits.h bits/std_algorithm.h bits/concept_checks.h bits/container_concepts.h bits/sequence_concepts.h bits/stl_construct.h base_headers = \
bits/cpp_type_traits.h bits/char_traits.h bits/codecvt.h \
bits/stringfwd.h bits/std_string.h bits/basic_string.h \
bits/basic_string.tcc \
bits/generic_shadow.h bits/std_utility.h \
bits/std_complex.h \
bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h \
bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h \
bits/gslice.h bits/gslice_array.h bits/indirect_array.h \
bits/std_fstream.h bits/std_iomanip.h \
bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc \
bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h \
bits/std_istream.h bits/istream.tcc bits/std_locale.h \
bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc \
bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h \
bits/streambuf.tcc bits/basic_file.h \
bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \
bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \
bits/stl_threads.h \
bits/stl_iterator_base_types.h bits/stl_iterator_base_funcs.h \
bits/std_bitset.h bits/std_deque.h bits/std_functional.h \
bits/std_iterator.h bits/std_list.h \
bits/std_map.h bits/std_memory.h bits/std_numeric.h \
bits/std_queue.h bits/std_set.h bits/std_stack.h \
bits/std_stdexcept.h bits/functexcept.h bits/std_vector.h \
bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h \
bits/stl_deque.h bits/stl_function.h \
bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \
bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \
bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \
bits/stl_relops.h bits/stl_set.h bits/stl_stack.h bits/stl_tempbuf.h \
bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \
bits/stl_bvector.h bits/type_traits.h bits/std_algorithm.h \
bits/stl_construct.h bits/boost_concept_check.h bits/concept_check.h
backward_headers = backward/complex.h backward/iomanip.h backward/istream.h backward/ostream.h backward/stream.h backward/streambuf.h backward/algo.h backward/algobase.h backward/alloc.h backward/bvector.h backward/defalloc.h backward/deque.h backward/function.h backward/hash_map.h backward/hash_set.h backward/hashtable.h backward/heap.h backward/iostream.h backward/iterator.h backward/list.h backward/map.h backward/multimap.h backward/new.h backward/multiset.h backward/pair.h backward/queue.h backward/rope.h backward/set.h backward/slist.h backward/stack.h backward/tempbuf.h backward/tree.h backward/vector.h backward/fstream.h backward/strstream.h backward/strstream backward_headers = \
backward/complex.h backward/iomanip.h backward/istream.h \
backward/ostream.h backward/stream.h backward/streambuf.h \
backward/algo.h backward/algobase.h backward/alloc.h \
backward/bvector.h backward/defalloc.h backward/deque.h \
backward/function.h backward/hash_map.h backward/hash_set.h \
backward/hashtable.h backward/heap.h backward/iostream.h \
backward/iterator.h backward/list.h backward/map.h \
backward/multimap.h backward/new.h backward/multiset.h \
backward/pair.h backward/queue.h backward/rope.h backward/set.h \
backward/slist.h backward/stack.h backward/tempbuf.h backward/tree.h \
backward/vector.h backward/fstream.h backward/strstream.h \
backward/strstream
ext_headers = ext/rope ext/ropeimpl.h ext/stl_rope.h ext/slist ext/hash_map ext/hash_set ext/stl_hashtable.h ext/stl_hash_fun.h ext_headers = \
ext/rope ext/ropeimpl.h ext/stl_rope.h \
ext/slist ext/hash_map ext/hash_set \
ext/stl_hashtable.h ext/stl_hash_fun.h
c_base_headers = bits/std_cassert.h bits/std_cctype.h bits/std_cerrno.h bits/std_cfloat.h bits/std_climits.h bits/std_clocale.h bits/std_cmath.h bits/std_csetjmp.h bits/std_csignal.h bits/std_cstdarg.h bits/std_cstddef.h bits/std_cstdio.h bits/std_cstdlib.h bits/std_cstring.h bits/std_ctime.h bits/std_cwchar.h bits/std_cwctype.h bits/cmath.tcc c_base_headers = \
bits/std_cassert.h bits/std_cctype.h bits/std_cerrno.h \
bits/std_cfloat.h bits/std_climits.h bits/std_clocale.h \
bits/std_cmath.h bits/std_csetjmp.h bits/std_csignal.h \
bits/std_cstdarg.h bits/std_cstddef.h bits/std_cstdio.h \
bits/std_cstdlib.h bits/std_cstring.h bits/std_ctime.h \
bits/std_cwchar.h bits/std_cwctype.h bits/cmath.tcc
@GLIBCPP_USE_CSHADOW_TRUE@c_shadow_headers = assert.h ctype.h errno.h float.h limits.h locale.h math.h setjmp.h signal.h stdarg.h stddef.h stdio.h stdlib.h string.h time.h wchar.h wctype.h fcntl.h libio.h iolibio.h libioP.h pthread.h iconv.h features.h langinfo.h bits/wrap_libio.h bits/wrap_iolibio.h bits/wrap_libioP.h bits/wrap_iconv.h bits/wrap_fcntl.h bits/wrap_pthread.h bits/wrap_features.h bits/wrap_langinfo.h sys/cdefs.h @GLIBCPP_USE_CSHADOW_TRUE@c_shadow_headers = @GLIBCPP_USE_CSHADOW_TRUE@\
@GLIBCPP_USE_CSHADOW_TRUE@ assert.h ctype.h errno.h float.h limits.h locale.h math.h setjmp.h \
@GLIBCPP_USE_CSHADOW_TRUE@ signal.h stdarg.h stddef.h stdio.h stdlib.h string.h time.h wchar.h \
@GLIBCPP_USE_CSHADOW_TRUE@ wctype.h fcntl.h libio.h iolibio.h libioP.h pthread.h iconv.h \
@GLIBCPP_USE_CSHADOW_TRUE@ features.h langinfo.h \
@GLIBCPP_USE_CSHADOW_TRUE@ bits/wrap_libio.h bits/wrap_iolibio.h bits/wrap_libioP.h \
@GLIBCPP_USE_CSHADOW_TRUE@ bits/wrap_iconv.h bits/wrap_fcntl.h bits/wrap_pthread.h \
@GLIBCPP_USE_CSHADOW_TRUE@ bits/wrap_features.h bits/wrap_langinfo.h \
@GLIBCPP_USE_CSHADOW_TRUE@ sys/cdefs.h
@GLIBCPP_USE_CSHADOW_FALSE@c_shadow_headers = @GLIBCPP_USE_CSHADOW_FALSE@c_shadow_headers =
std_headers = algorithm bitset complex deque fstream functional iomanip ios iosfwd iostream istream iterator limits list locale map memory numeric ostream queue set sstream stack stdexcept streambuf string utility valarray vector cassert cctype cerrno cfloat climits clocale ciso646 cmath csetjmp csignal cstdarg cstddef cstdio cstdlib cstring ctime cwchar cwctype std_headers = \
algorithm bitset complex deque fstream functional \
iomanip ios iosfwd iostream istream iterator limits list locale \
map memory numeric ostream queue set sstream stack stdexcept \
streambuf string utility valarray vector \
cassert cctype cerrno cfloat climits clocale ciso646 \
cmath csetjmp csignal cstdarg cstddef cstdio cstdlib \
cstring ctime cwchar cwctype
@GLIBCPP_NEED_LIBIO_TRUE@libio_headers = $(top_srcdir)/libio/_G_config.h $(top_srcdir)/libio/libio.h @GLIBCPP_NEED_LIBIO_TRUE@libio_headers = @GLIBCPP_NEED_LIBIO_TRUE@\
@GLIBCPP_NEED_LIBIO_TRUE@ $(top_srcdir)/libio/_G_config.h $(top_srcdir)/libio/libio.h
@GLIBCPP_NEED_LIBIO_FALSE@libio_headers = @GLIBCPP_NEED_LIBIO_FALSE@libio_headers =
build_headers = bits/std_limits.h bits/c++config.h bits/c++io.h bits/c++locale.h bits/c++threads.h bits/basic_file_model.h bits/atomicity.h bits/os_defines.h bits/ctype_base.h bits/ctype_noninline.h bits/ctype_inline.h build_headers = \
bits/std_limits.h \
bits/c++config.h bits/c++io.h bits/c++locale.h bits/c++threads.h \
bits/basic_file_model.h \
bits/atomicity.h bits/os_defines.h \
bits/ctype_base.h bits/ctype_noninline.h bits/ctype_inline.h
sources = limitsMEMBERS.cc stdexcept.cc functexcept.cc bitset.cc globals.cc basic_file.cc ios.cc complex_io.cc strstream.cc c++locale.cc locale.cc localename.cc codecvt.cc locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc wstring-inst.cc sources = \
limitsMEMBERS.cc \
stdexcept.cc functexcept.cc bitset.cc \
globals.cc \
basic_file.cc ios.cc complex_io.cc strstream.cc \
c++locale.cc locale.cc localename.cc codecvt.cc \
locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc \
string-inst.cc wstring-inst.cc
VPATH = $(top_srcdir) $(top_srcdir)/src $(GLIBCPP_INCLUDE_DIR) $(GLIBCPP_INCLUDE_DIR)/std $(C_INCLUDE_DIR) VPATH = $(top_srcdir) $(top_srcdir)/src $(GLIBCPP_INCLUDE_DIR) $(GLIBCPP_INCLUDE_DIR)/std $(C_INCLUDE_DIR)
libstdc___la_SOURCES = $(sources) libstdc___la_SOURCES = $(sources)
libstdc___la_LIBADD = ../libmath/libmath.la @libio_la@ ../libsupc++/libsupc++convenience.la libstdc___la_LIBADD = \
../libmath/libmath.la @libio_la@ \
../libsupc++/libsupc++convenience.la
libstdc___la_LDFLAGS = -version-info 3:0:0 -lm libstdc___la_LDFLAGS = -version-info 3:0:0 -lm
libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD) libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD)
@GLIBCPP_USE_CSHADOW_TRUE@CSHADOW_H = $(top_builddir)/stamp-cshadow @GLIBCPP_USE_CSHADOW_TRUE@CSHADOW_H = @GLIBCPP_USE_CSHADOW_TRUE@$(top_builddir)/stamp-cshadow
@GLIBCPP_USE_CSHADOW_FALSE@CSHADOW_H = @GLIBCPP_USE_CSHADOW_FALSE@CSHADOW_H =
# Check for various configure bits that change where the headers get installed. # Check for various configure bits that change where the headers get installed.
@ -193,7 +283,16 @@ c_incdir = @C_INCLUDE_DIR@
# set this option because CONFIG_CXXFLAGS has to be after # set this option because CONFIG_CXXFLAGS has to be after
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
# as the occasion call for it. (ie, --enable-debug) # as the occasion call for it. (ie, --enable-debug)
AM_CXXFLAGS = -fno-implicit-templates $(LIBSUPCXX_CXXFLAGS) $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) #
# The no-implicit-templates flag will generate unresolved references to
# the concept-checking symbols. So we must disable the checks while
# actually building the library.
AM_CXXFLAGS = \
-fno-implicit-templates -D_GLIBCPP_NO_CONCEPT_CHECKS \
$(LIBSUPCXX_CXXFLAGS) \
$(WARN_CXXFLAGS) \
$(OPTIMIZE_CXXFLAGS) \
$(CONFIG_CXXFLAGS)
# libstdc++ libtool notes # libstdc++ libtool notes
@ -214,7 +313,8 @@ AM_CXXFLAGS = -fno-implicit-templates $(LIBSUPCXX_CXXFLAGS) $(WARN_CXXFLAGS)
# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
# attempt to infer which configuration to use # attempt to infer which configuration to use
LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
# 3) We'd have a problem when building the shared libstdc++ object if # 3) We'd have a problem when building the shared libstdc++ object if
@ -223,7 +323,8 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) $(
# course is problematic at this point. So, we get the top-level # course is problematic at this point. So, we get the top-level
# directory to configure libstdc++-v3 to use gcc as the C++ # directory to configure libstdc++-v3 to use gcc as the C++
# compilation driver. # compilation driver.
CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@ CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
@OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
CONFIG_HEADER = ../config.h CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =

View file

@ -118,10 +118,14 @@ AUTOMAKE_OPTIONS = foreign dejagnu no-installinfo
DEJATOOL = libstdc++ DEJATOOL = libstdc++
EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then echo $(top_builddir)/../expect/expect ; else echo expect ; fi` EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \
echo $(top_builddir)/../expect/expect ; \
else echo expect ; fi`
RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then echo $(top_srcdir)/../dejagnu/runtest ; else echo runtest; fi` RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
echo $(top_srcdir)/../dejagnu/runtest ; \
else echo runtest; fi`
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_HEADER = ../config.h CONFIG_HEADER = ../config.h