diff options
author | Phil Edwards <pme@gcc.gnu.org> | 2001-04-03 00:26:58 +0000 |
---|---|---|
committer | Phil Edwards <pme@gcc.gnu.org> | 2001-04-03 00:26:58 +0000 |
commit | 30a20a1ee0168656d375ea2333e14b46937bdc6a (patch) | |
tree | bafb595dea147deb7ac77eeb4fcdb31ddddbc477 | |
parent | 9f4a318c36db4565f126e4428ea856460437b27d (diff) | |
download | gcc-30a20a1ee0168656d375ea2333e14b46937bdc6a.zip gcc-30a20a1ee0168656d375ea2333e14b46937bdc6a.tar.gz gcc-30a20a1ee0168656d375ea2333e14b46937bdc6a.tar.bz2 |
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
54 files changed, 3234 insertions, 2377 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 30c9eb6..4650659 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -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> * testsuite/lib/libstdc++.exp (dg-test): Annotate result diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in index 6fb1b8f..301025b 100644 --- a/libstdc++-v3/Makefile.in +++ b/libstdc++-v3/Makefile.in @@ -135,7 +135,48 @@ MULTICLEAN = true # 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 # 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 CONFIG_HEADER = config.h diff --git a/libstdc++-v3/docs/html/17_intro/concept_check.diff b/libstdc++-v3/docs/html/17_intro/concept_check.diff new file mode 100644 index 0000000..afb17f5e --- /dev/null +++ b/libstdc++-v3/docs/html/17_intro/concept_check.diff @@ -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 + }; + + //=========================================================================== + diff --git a/libstdc++-v3/docs/html/17_intro/howto.html b/libstdc++-v3/docs/html/17_intro/howto.html index 707d04d..ae568d4 100644 --- a/libstdc++-v3/docs/html/17_intro/howto.html +++ b/libstdc++-v3/docs/html/17_intro/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 17</TITLE> <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> <BODY> @@ -144,9 +144,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. -<BR> $Id: howto.html,v 1.6 2000/12/03 23:47:47 jsm28 Exp $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.1 2000/12/10 04:03:09 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/18_support/howto.html b/libstdc++-v3/docs/html/18_support/howto.html index 8dbc96c..f2b5d88 100644 --- a/libstdc++-v3/docs/html/18_support/howto.html +++ b/libstdc++-v3/docs/html/18_support/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 18</TITLE> <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> <BODY> @@ -259,9 +259,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. -<BR> $Id: howto.html,v 1.7 2000/12/03 23:47:47 jsm28 Exp $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:54 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/19_diagnostics/howto.html b/libstdc++-v3/docs/html/19_diagnostics/howto.html index 7b072ea..26ba4cd 100644 --- a/libstdc++-v3/docs/html/19_diagnostics/howto.html +++ b/libstdc++-v3/docs/html/19_diagnostics/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 19</TITLE> <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> <BODY> @@ -26,7 +26,7 @@ <UL> <LI><A HREF="#1">Adding data to exceptions</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> <HR> @@ -67,58 +67,44 @@ </P> <HR> -<H2><A NAME="3">Concept checkers</A></H2> - <P>First the good news, then the bad news.</P> - <P><STRONG>Good news:</STRONG> As part of their 3.3 release, SGI - added some nifty macros which - perform assertions on type properties. For example, the Standard - requires that types passed as template parameters to <TT>vector</TT> - be "Assignable" (which means what you think it means). +<H2><A NAME="3">Concept checkers -- <STRONG>new and improved!</STRONG></A></H2> + <P>Better taste! Less fat! Literally!</P> + <P>In 1999, SGI added <EM>concept checkers</EM> to their implementation + of the STL: code which checked the template parameters of + instantiated pieces of the STL, in order to insure that the parameters + being used met the requirements of the standard. For example, + the Standard requires that types passed as template parameters to + <TT>vector</TT> be "Assignable" (which means what you think + it means). The checking was done during compilation, and none of + the code was executed at runtime. </P> - <P>The concept checkers allow the source code for <TT>vector</TT> to - declare - <PRE> - __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<MyType></TT>, compile-time checking can be done on - whether MyType meets the requirements for vectors. + <P>Unfortunately, the size of the compiler files grew significantly + as a result. The checking code itself was cumbersome. And bugs + were found in it on more than one occasion. </P> - <P>Most (all?) of the containers and sequences are capable of performing - concept checking during compilation, not just vector. + <P>The primary author of the checking code, Jeremy Siek, had already + started work on a replcement implementation. The new code has been + formally reviewed and accepted into + <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>If a concept is violated (thus causing a compilation failure), the - error messages printed by the compiler will be of the form - <PRE> - _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>The new version imposes a much smaller space overhead on the generated + object file. The checks are also cleaner and easier to read and + understand. </P> - <P>Other names might be seen for more specific errors, for example, - _ERROR_IN_STL_CONTAINER::__begin_iterator_accessor_requirement_violation. + <P>Concept checking can be disabled when you build your code, for example, + to save space during a production build. Just define (via -D or + #define) any of the macros + <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>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 <A HREF="../faq/index.html">to the FAQ</A>. </P> @@ -129,9 +115,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<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 $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.2 2001/03/25 00:01:56 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/20_util/howto.html b/libstdc++-v3/docs/html/20_util/howto.html index e642ea7..f959468 100644 --- a/libstdc++-v3/docs/html/20_util/howto.html +++ b/libstdc++-v3/docs/html/20_util/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 20</TITLE> <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> <BODY> @@ -212,9 +212,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<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 $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.2 2001/01/23 17:02:27 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/21_strings/howto.html b/libstdc++-v3/docs/html/21_strings/howto.html index cdc8368..8025426 100644 --- a/libstdc++-v3/docs/html/21_strings/howto.html +++ b/libstdc++-v3/docs/html/21_strings/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 21</TITLE> <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> <BODY> @@ -329,9 +329,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<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 $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.2 2001/02/07 00:03:20 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/22_locale/howto.html b/libstdc++-v3/docs/html/22_locale/howto.html index cbf1daf..868b3d9 100644 --- a/libstdc++-v3/docs/html/22_locale/howto.html +++ b/libstdc++-v3/docs/html/22_locale/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 22</TITLE> <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> <BODY> @@ -225,9 +225,8 @@ functionality are given. <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<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 $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.2 2001/02/07 00:03:20 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/23_containers/howto.html b/libstdc++-v3/docs/html/23_containers/howto.html index a6c0afc..c8350a7 100644 --- a/libstdc++-v3/docs/html/23_containers/howto.html +++ b/libstdc++-v3/docs/html/23_containers/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 23</TITLE> <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> <BODY> @@ -235,9 +235,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. -<BR> $Id: howto.html,v 1.4 2000/12/03 23:47:48 jsm28 Exp $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/24_iterators/howto.html b/libstdc++-v3/docs/html/24_iterators/howto.html index a807cf3..5210632 100644 --- a/libstdc++-v3/docs/html/24_iterators/howto.html +++ b/libstdc++-v3/docs/html/24_iterators/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 24</TITLE> <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> <BODY> @@ -84,9 +84,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. -<BR> $Id: howto.html,v 1.5 2000/12/03 23:47:48 jsm28 Exp $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/25_algorithms/howto.html b/libstdc++-v3/docs/html/25_algorithms/howto.html index c161b18..f0481cd 100644 --- a/libstdc++-v3/docs/html/25_algorithms/howto.html +++ b/libstdc++-v3/docs/html/25_algorithms/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 25</TITLE> <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> <BODY> @@ -86,9 +86,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. -<BR> $Id: howto.html,v 1.5 2000/12/03 23:47:48 jsm28 Exp $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/26_numerics/howto.html b/libstdc++-v3/docs/html/26_numerics/howto.html index c69532d..4f33841 100644 --- a/libstdc++-v3/docs/html/26_numerics/howto.html +++ b/libstdc++-v3/docs/html/26_numerics/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 26</TITLE> <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> <BODY> @@ -132,9 +132,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. -<BR> $Id: howto.html,v 1.7 2000/12/03 23:47:48 jsm28 Exp $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:56 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/27_io/howto.html b/libstdc++-v3/docs/html/27_io/howto.html index a6aa045..0da4417 100644 --- a/libstdc++-v3/docs/html/27_io/howto.html +++ b/libstdc++-v3/docs/html/27_io/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Chapter 27</TITLE> <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> <BODY> @@ -415,9 +415,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<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 $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.3 2001/02/07 00:03:21 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/ext/howto.html b/libstdc++-v3/docs/html/ext/howto.html index 78755c6..84b8b8d 100644 --- a/libstdc++-v3/docs/html/ext/howto.html +++ b/libstdc++-v3/docs/html/ext/howto.html @@ -8,7 +8,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 HOWTO: Extensions</TITLE> <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> <BODY> @@ -141,8 +141,8 @@ <HR> <H2><A NAME="4">Compile-time checks</A></H2> - <P>Currently libstdc++-v3 uses the concept checkers from SGI's STL - 3.3 to perform <A HREF="../19_diagnostics/howto.html#3">optional + <P>Currently libstdc++-v3 uses the concept checkers from the Boost + library to perform <A HREF="../19_diagnostics/howto.html#3">optional compile-time checking</A> of template instantiations of the standard containers. They are described in the linked-to page. </P> @@ -158,9 +158,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<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 $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: howto.html,v 1.2 2001/03/25 00:01:56 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/faq/index.html b/libstdc++-v3/docs/html/faq/index.html index 95ab8fb..80bb256 100644 --- a/libstdc++-v3/docs/html/faq/index.html +++ b/libstdc++-v3/docs/html/faq/index.html @@ -9,7 +9,7 @@ ** Locations of "the most recent snapshot is the Nth" text are ** answers 1_1, 1_4, 4_1, 5_6. --> -<!-- $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> <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_3">Bugs in the C++ language/lib specification</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_rel_ops">"ambiguous overloads" - 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 <STRONG>not ours</STRONG></A> <LI><A HREF="#4_4_glibc">compilation errors from streambuf.h</A> - <LI><A HREF="#4_4_checks">_STL_ERROR::__something_huge_...</A> - </UL> + <LI><A HREF="#4_4_checks">errors about <EM>*Cconcept</EM> and + <EM>constraints</EM> in the STL...</A> + </UL> <LI><A HREF="#4_5">Aw, that's easy to fix!</A> </OL> @@ -258,7 +259,7 @@ which is no longer available, thanks deja...--> that building GCC is much easier and more automated than building the GCC 2.[78] series was. <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/automake/">automake</A>. <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> <P>The <EM>Concurrent Versions System</EM> is one of several revision 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 the GNU software catalogue</A> has a better description as 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>The "anonymous client checkout" feature of CVS is similar to anonymous FTP in that it allows anyone to retrieve @@ -371,7 +372,7 @@ HREF="http://sources.redhat.com/automake/">automake</A>. </P> <P>You have two options. You can get a newer cygwin1.dll (see 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 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>. @@ -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> <P>The <TT>atomicity.h</TT> header for the Alpha processor currently uses pseudo-operators which the DEC assembler - doesn't understand (in particular, .subsection and .previous). - The simple solution is to install GNU <TT>as</TT> and arrange - for the GCC build to use it (or merge the sources and build - it during the bootstrap). + doesn't understand (in particular, .subsection and .previous). + The simple solution is to install GNU <TT>as</TT> and arrange + for the GCC build to use it (or merge the sources and build + it during the bootstrap). </P> <P>Anyone who <A HREF="http://gcc.gnu.org/ml/libstdc++/2000-12/msg00279.html">knows - the DEC assembler well enough</A> to provide the equivalent of - these two pseudos would win praise and accolades from many. + the DEC assembler well enough</A> to provide the equivalent of + these two pseudos would win praise and accolades from many. </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"> <P>Another is the <TT>rel_ops</TT> namespace and the template comparison operator functions contained therein. If they become - visible in the same namespace as other comparison functions - (e.g., '<TT>using</TT>' them and the <iterator> header), - then you will suddenly be faced with huge numbers of ambiguity - errors. This was discussed on the -v3 list; Nathan Myers - <A HREF="http://gcc.gnu.org/ml/libstdc++/2001-01/msg00247.html">sums - things up here</A>. + visible in the same namespace as other comparison functions + (e.g., '<TT>using</TT>' them and the <iterator> header), + then you will suddenly be faced with huge numbers of ambiguity + errors. This was discussed on the -v3 list; Nathan Myers + <A HREF="http://gcc.gnu.org/ml/libstdc++/2001-01/msg00247.html">sums + things up here</A>. </P> </A> <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 NAME="4_4_glibc"> <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 - read the glibc FAQ, specifically 2.34: + glibc 2.2, but are still using gcc 2.95.2, then you should have + read the glibc FAQ, specifically 2.34: <PRE> 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 http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff </PRE> - Note that 2.95.x shipped with the - <A HREF="#4_4_interface">old v2 library</A> which is no longer - maintained. + Note that 2.95.x shipped with the + <A HREF="#4_4_interface">old v2 library</A> which is no longer + maintained. </P> </A> <A NAME="4_4_checks"> - <P>If you see compilation errors containing messages which begin - with _STL_ERROR:: followed by a very verbose name, then most - likely you have violated one of the requirements for types used - during instantiation of template containers. For example, - _STL_ERROR::__equality_comparable_requirement_violation appears + <P>If you see compilation errors containing messages about + <TT> <EM>foo</EM>Concept </TT>and a<TT> constraints </TT> + member function, then most + likely you have violated one of the requirements for types used + during instantiation of template containers. For example, + EqualityComparableConcept appears if your types must be comparable with == and you have not provided this capability (a typo, or wrong visibility, or you - just plain forgot, etc). + just plain forgot, etc). </P> - <P>More information, including how to optionally disable the checks, - is available <A HREF="../19_diagnostics/howto.html#3">here</A>. - The code itself might be disabled or replaced already. + <P>More information, including how to optionally disable the checks, + is available <A HREF="../19_diagnostics/howto.html#3">here</A>. </P> </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 patches</A> that covers the procedure, but for libstdc++ you should also send the patch to our mailing list in addition to - the GCC patches mailing list. The libstdc++ + the GCC patches mailing list. The libstdc++ <A HREF="../17_intro/contribute.html">contributors' page</A> also talks about how to submit patches. </P> @@ -720,9 +721,8 @@ HREF="http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html">speculation</A>. <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. -<BR> $Id: index.html,v 1.4 2001/03/01 22:32:23 pme Exp $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: index.html,v 1.5 2001/03/25 00:01:57 pme Exp $ </EM></P> diff --git a/libstdc++-v3/docs/html/faq/index.txt b/libstdc++-v3/docs/html/faq/index.txt index 8af6565..9ad8712 100644 --- a/libstdc++-v3/docs/html/faq/index.txt +++ b/libstdc++-v3/docs/html/faq/index.txt @@ -38,7 +38,7 @@ header o [28]The g++-3 headers are not ours o [29]compilation errors from streambuf.h - o [30]_STL_ERROR::__something_huge_... + o [30]errors about *Cconcept and constraints in the STL... 5. [31]Aw, that's easy to fix! 5. [32]Miscellaneous 1. [33]string::iterator is not char*; vector<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 longer maintained. - If you see compilation errors containing messages which begin with - _STL_ERROR:: followed by a very verbose name, then most likely you - have violated one of the requirements for types used during - instantiation of template containers. For example, - _STL_ERROR::__equality_comparable_requirement_violation appears if - your types must be comparable with == and you have not provided this + If you see compilation errors containing messages about fooConcept and + a constraints member function, then most likely you have violated one + of the requirements for types used during instantiation of template + containers. For example, EqualityComparableConcept appears if your + types must be comparable with == and you have not provided this capability (a typo, or wrong visibility, or you just plain forgot, etc). More information, including how to optionally disable the checks, is - available [69]here. The code itself might be disabled or replaced - already. + available [69]here. _________________________________________________________________ 4.5 Aw, that's easy to fix! @@ -573,9 +571,9 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff out! _________________________________________________________________ - Comments and suggestions are welcome, and may be sent to [83]Phil - Edwards or [84]Gabriel Dos Reis. - $Id: index.html,v 1.4 2001/03/01 22:32:23 pme Exp $ + Comments and suggestions are welcome, and may be sent to [83]the + mailing list. + $Id: index.html,v 1.5 2001/03/25 00:01:57 pme Exp $ References @@ -661,5 +659,4 @@ References 80. http://www.ansi.org/ 81. http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998 82. http://www.iso.ch/ - 83. mailto:pme@sources.redhat.com - 84. mailto:gdr@gcc.gnu.org + 83. mailto:libstdc++@gcc.gnu.org diff --git a/libstdc++-v3/docs/html/install.html b/libstdc++-v3/docs/html/install.html index fcc0c0d..24df89b 100644 --- a/libstdc++-v3/docs/html/install.html +++ b/libstdc++-v3/docs/html/install.html @@ -7,7 +7,7 @@ <META NAME="GENERATOR" CONTENT="vi and eight fingers"> <TITLE>libstdc++-v3 Installation Instructions</TITLE> <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> <BODY> @@ -333,9 +333,8 @@ <HR> <P CLASS="fineprint"><EM> Comments and suggestions are welcome, and may be sent to -<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or -<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>. -<BR> $Id: install.html,v 1.3 2001/01/23 17:02:26 pme Exp $ +<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>. +<BR> $Id: install.html,v 1.4 2001/02/07 00:03:20 pme Exp $ </EM></P> diff --git a/libstdc++-v3/include/bits/boost_concept_check.h b/libstdc++-v3/include/bits/boost_concept_check.h new file mode 100644 index 0000000..1142e04 --- /dev/null +++ b/libstdc++-v3/include/bits/boost_concept_check.h @@ -0,0 +1,887 @@ +// +// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, +// sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +// + +// GCC Note: based on version 1.12.0 of the Boost library. +#ifndef BOOST_CONCEPT_CHECKS_HPP +#define BOOST_CONCEPT_CHECKS_HPP + +#pragma GCC system_header +#include <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 + diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 2a007f9..84a9ebc 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -63,9 +63,8 @@ # define __STL_UITHREADS #endif -// Concept-checking code is off by default unless users define -// the _STL_USE_CONCEPT_CHECKS hook. -//#define _STL_USE_CONCEPT_CHECKS 1 +// Concept-checking hooks and related config are now in bits/concept_check.h. + // This is also a user hook, but via -f[no-]exceptions, not direct #defines. #ifdef __EXCEPTIONS @@ -85,7 +84,8 @@ # define __STL_UNWIND(action) #endif -// This is the "underlying allocator" +// This is the "underlying allocator" for STL. The alternatives are +// homegrown schemes involving a kind of mutex and free list; see stl_alloc.h. #define __USE_MALLOC // Define this to permit user-level control of the expansion of string @@ -105,11 +105,6 @@ //# define __STL_LONG_LONG //#endif -// 20010302 pme -- this is only used in bits/concept_checks.h -//#if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95) -# define __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE -//#endif - // Mingw32, GCC compiler using the Microsoft C runtime (settings taken from // SGI's stl_config.h) #if defined(__MINGW32__) diff --git a/libstdc++-v3/include/bits/concept_check.h b/libstdc++-v3/include/bits/concept_check.h new file mode 100644 index 0000000..28886a9 --- /dev/null +++ b/libstdc++-v3/include/bits/concept_check.h @@ -0,0 +1,93 @@ +// Concept-checking control -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CONCEPT_CHECK +#define _GLIBCPP_CONCEPT_CHECK 1 + +#pragma GCC system_header +#include <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 + diff --git a/libstdc++-v3/include/bits/concept_checks.h b/libstdc++-v3/include/bits/concept_checks.h deleted file mode 100644 index aa77d9a..0000000 --- a/libstdc++-v3/include/bits/concept_checks.h +++ /dev/null @@ -1,811 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __CONCEPT_CHECKS_H -#define __CONCEPT_CHECKS_H - -/* - Use these macro like assertions, but they assert properties - on types (usually template arguments). In technical terms they - verify whether a type "models" a "concept". - - This set of requirements and the terminology used here is derived - from the book "Generic Programming and the STL" by Matt Austern - (Addison Wesley). For further information please consult that - book. The requirements also are intended to match the ANSI/ISO C++ - standard. - - This file covers the basic concepts and the iterator concepts. - There are several other files that provide the requirements - for the STL containers: - container_concepts.h - sequence_concepts.h - assoc_container_concepts.h - - Jeremy Siek, 1999 - - TO DO: - - some issues with regards to concept classification and mutability - including AssociativeContianer -> ForwardContainer - and SortedAssociativeContainer -> ReversibleContainer - - HashedAssociativeContainer - - Allocator - - Function Object Concepts - - */ - -#ifndef __STL_USE_CONCEPT_CHECKS - -// Some compilers lack the features that are necessary for concept checks. -// On those compilers we define the concept check macros to do nothing. -#define __STL_REQUIRES(__type_var, __concept) do {} while(0) -#define __STL_CLASS_REQUIRES(__type_var, __concept) \ - static int __##__type_var##_##__concept -#define __STL_CONVERTIBLE(__type_x, __type_y) do {} while(0) -#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0) -#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \ - static int __##__type_x##__type_y##_require_same_type -#define __STL_GENERATOR_CHECK(__func, __ret) do {} while(0) -#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \ - static int __##__func##__ret##_generator_check -#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0) -#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ - static int __##__func##__ret##__arg##_unary_function_check -#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ - do {} while(0) -#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ - static int __##__func##__ret##__first##__second##_binary_function_check -#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ - do {} while(0) -#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ - static int __##__opname##__ret##__first##__second##_require_binary_op - -#else /* __STL_USE_CONCEPT_CHECKS */ - -// This macro tests whether the template argument "__type_var" -// satisfies the requirements of "__concept". Here is a list of concepts -// that we know how to check: -// _Allocator -// _Assignable -// _DefaultConstructible -// _EqualityComparable -// _LessThanComparable -// _TrivialIterator -// _InputIterator -// _OutputIterator -// _ForwardIterator -// _BidirectionalIterator -// _RandomAccessIterator -// _Mutable_TrivialIterator -// _Mutable_ForwardIterator -// _Mutable_BidirectionalIterator -// _Mutable_RandomAccessIterator - -#define __STL_REQUIRES(__type_var, __concept) \ -do { \ - void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\ - ::__concept##_requirement_violation; __x = __x; } while (0) - -// Use this to check whether type X is convertible to type Y -#define __STL_CONVERTIBLE(__type_x, __type_y) \ -do { \ - void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \ - __type_y >::__type_X_is_not_convertible_to_type_Y; \ - __x = __x; } while (0) - -// Use this to test whether two template arguments are the same type -#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) \ -do { \ - void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \ - __type_y >::__type_X_not_same_as_type_Y; \ - __x = __x; } while (0) - - -// function object checks -#define __STL_GENERATOR_CHECK(__func, __ret) \ -do { \ - __ret (*__x)( __func&) = \ - _STL_GENERATOR_ERROR< \ - __func, __ret>::__generator_requirement_violation; \ - __x = __x; } while (0) - - -#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ -do { \ - __ret (*__x)( __func&, const __arg& ) = \ - _STL_UNARY_FUNCTION_ERROR< \ - __func, __ret, __arg>::__unary_function_requirement_violation; \ - __x = __x; } while (0) - - -#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ -do { \ - __ret (*__x)( __func&, const __first&, const __second& ) = \ - _STL_BINARY_FUNCTION_ERROR< \ - __func, __ret, __first, __second>::__binary_function_requirement_violation; \ - __x = __x; } while (0) - - -#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ - do { \ - __ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \ - __ret, __first, __second>::__binary_operator_requirement_violation; \ - __ret (*__y)( const __first&, const __second& ) = \ - _STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \ - __const_binary_operator_requirement_violation; \ - __y = __y; __x = __x; } while (0) - - -#ifdef __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE - -#define __STL_CLASS_REQUIRES(__type_var, __concept) -#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) -#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) -#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) -#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) -#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) - -#else - -// Use this macro inside of template classes, where you would -// like to place requirements on the template arguments to the class -// Warning: do not pass pointers and such (e.g. T*) in as the __type_var, -// since the type_var is used to construct identifiers. Instead typedef -// the pointer type, then use the typedef name for the __type_var. -#define __STL_CLASS_REQUIRES(__type_var, __concept) \ - typedef void (* __func##__type_var##__concept)( __type_var ); \ - template <__func##__type_var##__concept _Tp1> \ - struct __dummy_struct_##__type_var##__concept { }; \ - static __dummy_struct_##__type_var##__concept< \ - __concept##_concept_specification< \ - __type_var>::__concept##_requirement_violation> \ - __dummy_ptr_##__type_var##__concept - - -#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \ - typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \ - __type_y ); \ - template < __func_##__type_x##__type_y##same_type _Tp1> \ - struct __dummy_struct_##__type_x##__type_y##_same_type { }; \ - static __dummy_struct_##__type_x##__type_y##_same_type< \ - _STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y> \ - __dummy_ptr_##__type_x##__type_y##_same_type - - -#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \ - typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \ - template <__f_##__func##__ret##_generator _Tp1> \ - struct __dummy_struct_##__func##__ret##_generator { }; \ - static __dummy_struct_##__func##__ret##_generator< \ - _STL_GENERATOR_ERROR< \ - __func, __ret>::__generator_requirement_violation> \ - __dummy_ptr_##__func##__ret##_generator - - -#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ - typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \ - const __arg& ); \ - template <__f_##__func##__ret##__arg##_unary_check _Tp1> \ - struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \ - static __dummy_struct_##__func##__ret##__arg##_unary_check< \ - _STL_UNARY_FUNCTION_ERROR< \ - __func, __ret, __arg>::__unary_function_requirement_violation> \ - __dummy_ptr_##__func##__ret##__arg##_unary_check - - -#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ - typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\ - const __second& ); \ - template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \ - struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \ - static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \ - _STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \ - __binary_function_requirement_violation> \ - __dummy_ptr_##__func##__ret##__first##__second##_binary_check - - -#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ - typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \ - const __second& ); \ - template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \ - struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \ - static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \ - _STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \ - __binary_operator_requirement_violation> \ - __dummy_ptr_##__func##__ret##__first##__second##_binary_op - -#endif - -/* helper class for finding non-const version of a type. Need to have - something to assign to etc. when testing constant iterators. */ - -template <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: diff --git a/libstdc++-v3/include/bits/container_concepts.h b/libstdc++-v3/include/bits/container_concepts.h deleted file mode 100644 index 99aec1c..0000000 --- a/libstdc++-v3/include/bits/container_concepts.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __STL_CONTAINER_CONCEPTS_H -#define __STL_CONTAINER_CONCEPTS_H - - -#include <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 */ diff --git a/libstdc++-v3/include/bits/sbuf_iter.h b/libstdc++-v3/include/bits/sbuf_iter.h index 2b2a191..052b0df 100644 --- a/libstdc++-v3/include/bits/sbuf_iter.h +++ b/libstdc++-v3/include/bits/sbuf_iter.h @@ -39,7 +39,7 @@ namespace std template<typename _CharT, typename _Traits> class ostreambuf_iterator -#if 0 // XXX this is standard: +#if 1 // XXX this is standard: : public iterator<output_iterator_tag, _CharT, void, void, void> #else : public output_iterator diff --git a/libstdc++-v3/include/bits/sequence_concepts.h b/libstdc++-v3/include/bits/sequence_concepts.h deleted file mode 100644 index f251e2e..0000000 --- a/libstdc++-v3/include/bits/sequence_concepts.h +++ /dev/null @@ -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 */ diff --git a/libstdc++-v3/include/bits/std_iterator.h b/libstdc++-v3/include/bits/std_iterator.h index f457715..cb97ed1 100644 --- a/libstdc++-v3/include/bits/std_iterator.h +++ b/libstdc++-v3/include/bits/std_iterator.h @@ -31,7 +31,8 @@ #include <bits/c++config.h> #include <bits/std_cstddef.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> #endif /* _CPP_ITERATOR */ diff --git a/libstdc++-v3/include/bits/std_memory.h b/libstdc++-v3/include/bits/std_memory.h index 0f58c08..4385a96 100644 --- a/libstdc++-v3/include/bits/std_memory.h +++ b/libstdc++-v3/include/bits/std_memory.h @@ -20,7 +20,7 @@ #include <bits/stl_algobase.h> #include <bits/stl_alloc.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_uninitialized.h> #include <bits/stl_raw_storage_iter.h> diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 090f0d6..929c4ff 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -33,8 +33,7 @@ #include <bits/stl_heap.h> -// See concept_checks.h for the concept-checking macros -// __STL_REQUIRES, __STL_CONVERTIBLE, etc. +// See concept_check.h for the glibcpp_*_requires macros. namespace std { @@ -42,8 +41,10 @@ namespace std // __median (an extension, not present in the C++ standard). template <class _Tp> -inline const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) { - __STL_REQUIRES(_Tp, _LessThanComparable); +inline const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) +{ + // concept requirements + glibcpp_function_requires(LessThanComparableConcept<_Tp>); if (__a < __b) if (__b < __c) return __b; @@ -61,8 +62,10 @@ inline const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) { template <class _Tp, class _Compare> inline const _Tp& -__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) { - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); +__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(BinaryFunctionConcept<_Compare, bool, _Tp, _Tp>); if (__comp(__a, __b)) if (__comp(__b, __c)) return __b; @@ -80,8 +83,10 @@ __median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) { // for_each. Apply a function to every element of a range. template <class _InputIter, class _Function> -_Function for_each(_InputIter __first, _InputIter __last, _Function __f) { - __STL_REQUIRES(_InputIter, _InputIterator); +_Function for_each(_InputIter __first, _InputIter __last, _Function __f) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); for ( ; __first != __last; ++__first) __f(*__first); return __f; @@ -189,28 +194,33 @@ template <class _InputIter, class _Tp> inline _InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, - typename iterator_traits<_InputIter>::value_type, _Tp); - return find(__first, __last, __val, __ITERATOR_CATEGORY(__first)); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(EqualOpConcept< + typename iterator_traits<_InputIter>::value_type, _Tp>); + return find(__first, __last, __val, __iterator_category(__first)); } template <class _InputIter, class _Predicate> inline _InputIter find_if(_InputIter __first, _InputIter __last, - _Predicate __pred) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, - typename iterator_traits<_InputIter>::value_type); - return find_if(__first, __last, __pred, __ITERATOR_CATEGORY(__first)); + _Predicate __pred) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIter>::value_type>); + return find_if(__first, __last, __pred, __iterator_category(__first)); } // adjacent_find. template <class _ForwardIter> -_ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, - _EqualityComparable); +_ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(EqualityComparableConcept< + typename iterator_traits<_ForwardIter>::value_type>); if (__first == __last) return __last; _ForwardIter __next = __first; @@ -224,11 +234,13 @@ _ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last) { template <class _ForwardIter, class _BinaryPredicate> _ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last, - _BinaryPredicate __binary_pred) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, - typename iterator_traits<_ForwardIter>::value_type, - typename iterator_traits<_ForwardIter>::value_type); + _BinaryPredicate __binary_pred) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type>); if (__first == __last) return __last; _ForwardIter __next = __first; @@ -248,11 +260,13 @@ _ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last, template <class _InputIter, class _Tp, class _Size> void count(_InputIter __first, _InputIter __last, const _Tp& __value, - _Size& __n) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(typename iterator_traits<_InputIter>::value_type, - _EqualityComparable); - __STL_REQUIRES(_Tp, _EqualityComparable); + _Size& __n) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(EqualityComparableConcept< + typename iterator_traits<_InputIter>::value_type >); + glibcpp_function_requires(EqualityComparableConcept<_Tp>); for ( ; __first != __last; ++__first) if (*__first == __value) ++__n; @@ -260,10 +274,12 @@ void count(_InputIter __first, _InputIter __last, const _Tp& __value, template <class _InputIter, class _Predicate, class _Size> void count_if(_InputIter __first, _InputIter __last, _Predicate __pred, - _Size& __n) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, - typename iterator_traits<_InputIter>::value_type); + _Size& __n) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIter>::value_type>); for ( ; __first != __last; ++__first) if (__pred(*__first)) ++__n; @@ -271,11 +287,13 @@ void count_if(_InputIter __first, _InputIter __last, _Predicate __pred, template <class _InputIter, class _Tp> typename iterator_traits<_InputIter>::difference_type -count(_InputIter __first, _InputIter __last, const _Tp& __value) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(typename iterator_traits<_InputIter>::value_type, - _EqualityComparable); - __STL_REQUIRES(_Tp, _EqualityComparable); +count(_InputIter __first, _InputIter __last, const _Tp& __value) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(EqualityComparableConcept< + typename iterator_traits<_InputIter>::value_type >); + glibcpp_function_requires(EqualityComparableConcept<_Tp>); typename iterator_traits<_InputIter>::difference_type __n = 0; for ( ; __first != __last; ++__first) if (*__first == __value) @@ -285,10 +303,12 @@ count(_InputIter __first, _InputIter __last, const _Tp& __value) { template <class _InputIter, class _Predicate> typename iterator_traits<_InputIter>::difference_type -count_if(_InputIter __first, _InputIter __last, _Predicate __pred) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, - typename iterator_traits<_InputIter>::value_type); +count_if(_InputIter __first, _InputIter __last, _Predicate __pred) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIter>::value_type>); typename iterator_traits<_InputIter>::difference_type __n = 0; for ( ; __first != __last; ++__first) if (__pred(*__first)) @@ -303,11 +323,12 @@ template <class _ForwardIter1, class _ForwardIter2> _ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2, _ForwardIter2 __last2) { - __STL_REQUIRES(_ForwardIter1, _ForwardIterator); - __STL_REQUIRES(_ForwardIter2, _ForwardIterator); - __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, - typename iterator_traits<_ForwardIter1>::value_type, - typename iterator_traits<_ForwardIter2>::value_type); + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter1>); + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter2>); + glibcpp_function_requires(EqualOpConcept< + typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type>); // Test for empty ranges if (__first1 == __last1 || __first2 == __last2) @@ -354,11 +375,12 @@ _ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPred __predicate) { - __STL_REQUIRES(_ForwardIter1, _ForwardIterator); - __STL_REQUIRES(_ForwardIter2, _ForwardIterator); - __STL_BINARY_FUNCTION_CHECK(_BinaryPred, bool, - typename iterator_traits<_ForwardIter1>::value_type, - typename iterator_traits<_ForwardIter2>::value_type); + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter1>); + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter2>); + glibcpp_function_requires(BinaryPredicateConcept<_BinaryPred, + typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type>); // Test for empty ranges if (__first1 == __last1 || __first2 == __last2) @@ -412,11 +434,13 @@ _ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, template <class _ForwardIter, class _Integer, class _Tp> _ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, - _Integer __count, const _Tp& __val) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, - _EqualityComparable); - __STL_REQUIRES(_Tp, _EqualityComparable); + _Integer __count, const _Tp& __val) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(EqualityComparableConcept< + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(EqualityComparableConcept<_Tp>); if (__count <= 0) return __first; @@ -442,10 +466,13 @@ _ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred> _ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, _Integer __count, const _Tp& __val, - _BinaryPred __binary_pred) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_BINARY_FUNCTION_CHECK(_BinaryPred, bool, - typename iterator_traits<_ForwardIter>::value_type, _Tp); + _BinaryPred __binary_pred) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(BinaryPredicateConcept<_BinaryPred, + typename iterator_traits<_ForwardIter>::value_type, _Tp>); + if (__count <= 0) return __first; else { @@ -481,13 +508,18 @@ _ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, template <class _ForwardIter1, class _ForwardIter2> _ForwardIter2 swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2) { - __STL_REQUIRES(_ForwardIter1, _Mutable_ForwardIterator); - __STL_REQUIRES(_ForwardIter2, _Mutable_ForwardIterator); - __STL_CONVERTIBLE(typename iterator_traits<_ForwardIter1>::value_type, - typename iterator_traits<_ForwardIter2>::value_type); - __STL_CONVERTIBLE(typename iterator_traits<_ForwardIter2>::value_type, - typename iterator_traits<_ForwardIter1>::value_type); + _ForwardIter2 __first2) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter1>); + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter2>); + glibcpp_function_requires(ConvertibleConcept< + typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type>); + glibcpp_function_requires(ConvertibleConcept< + typename iterator_traits<_ForwardIter2>::value_type, + typename iterator_traits<_ForwardIter1>::value_type>); + for ( ; __first1 != __last1; ++__first1, ++__first2) iter_swap(__first1, __first2); return __first2; @@ -497,9 +529,12 @@ _ForwardIter2 swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, template <class _InputIter, class _OutputIter, class _UnaryOperation> _OutputIter transform(_InputIter __first, _InputIter __last, - _OutputIter __result, _UnaryOperation __unary_op) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); + _OutputIter __result, _UnaryOperation __unary_op) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter>::value_type>); for ( ; __first != __last; ++__first, ++__result) *__result = __unary_op(*__first); @@ -510,10 +545,15 @@ template <class _InputIter1, class _InputIter2, class _OutputIter, class _BinaryOperation> _OutputIter transform(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _OutputIter __result, - _BinaryOperation __binary_op) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); + _BinaryOperation __binary_op) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + // XXX really should be "the type returned by _BinaryOperation + typename iterator_traits<_InputIter1>::value_type>); + for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result) *__result = __binary_op(*__first1, *__first2); return __result; @@ -523,11 +563,15 @@ _OutputIter transform(_InputIter1 __first1, _InputIter1 __last1, template <class _ForwardIter, class _Tp> void replace(_ForwardIter __first, _ForwardIter __last, - const _Tp& __old_value, const _Tp& __new_value) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); - __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, - typename iterator_traits<_ForwardIter>::value_type, _Tp); - __STL_CONVERTIBLE(_Tp, typename iterator_traits<_ForwardIter>::value_type); + const _Tp& __old_value, const _Tp& __new_value) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(EqualOpConcept< + typename iterator_traits<_ForwardIter>::value_type, _Tp>); + glibcpp_function_requires(ConvertibleConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + for ( ; __first != __last; ++__first) if (*__first == __old_value) *__first = __new_value; @@ -535,11 +579,15 @@ void replace(_ForwardIter __first, _ForwardIter __last, template <class _ForwardIter, class _Predicate, class _Tp> void replace_if(_ForwardIter __first, _ForwardIter __last, - _Predicate __pred, const _Tp& __new_value) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); - __STL_CONVERTIBLE(_Tp, typename iterator_traits<_ForwardIter>::value_type); - __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, - typename iterator_traits<_ForwardIter>::value_type); + _Predicate __pred, const _Tp& __new_value) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(ConvertibleConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(UnaryPredicateConcept<_Predicate, + typename iterator_traits<_ForwardIter>::value_type>); + for ( ; __first != __last; ++__first) if (__pred(*__first)) *__first = __new_value; @@ -548,11 +596,15 @@ void replace_if(_ForwardIter __first, _ForwardIter __last, template <class _InputIter, class _OutputIter, class _Tp> _OutputIter replace_copy(_InputIter __first, _InputIter __last, _OutputIter __result, - const _Tp& __old_value, const _Tp& __new_value) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, - typename iterator_traits<_InputIter>::value_type, _Tp); + const _Tp& __old_value, const _Tp& __new_value) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter>::value_type>); + glibcpp_function_requires(EqualOpConcept< + typename iterator_traits<_InputIter>::value_type, _Tp>); + for ( ; __first != __last; ++__first, ++__result) *__result = *__first == __old_value ? __new_value : *__first; return __result; @@ -561,11 +613,15 @@ _OutputIter replace_copy(_InputIter __first, _InputIter __last, template <class _InputIter, class _OutputIter, class _Predicate, class _Tp> _OutputIter replace_copy_if(_InputIter __first, _InputIter __last, _OutputIter __result, - _Predicate __pred, const _Tp& __new_value) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, - typename iterator_traits<_InputIter>::value_type); + _Predicate __pred, const _Tp& __new_value) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter>::value_type>); + glibcpp_function_requires(UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIter>::value_type>); + for ( ; __first != __last; ++__first, ++__result) *__result = __pred(*__first) ? __new_value : *__first; return __result; @@ -574,17 +630,26 @@ _OutputIter replace_copy_if(_InputIter __first, _InputIter __last, // generate and generate_n template <class _ForwardIter, class _Generator> -void generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_GENERATOR_CHECK(_Generator, - typename iterator_traits<_ForwardIter>::value_type); +void generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(GeneratorConcept<_Generator, + typename iterator_traits<_ForwardIter>::value_type>); + for ( ; __first != __last; ++__first) *__first = __gen(); } template <class _OutputIter, class _Size, class _Generator> -_OutputIter generate_n(_OutputIter __first, _Size __n, _Generator __gen) { - __STL_REQUIRES(_OutputIter, _OutputIterator); +_OutputIter generate_n(_OutputIter __first, _Size __n, _Generator __gen) +{ +/* + // XXX concept requirements + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + "the return type of _Generator" ?? >); +*/ + for ( ; __n > 0; --__n, ++__first) *__first = __gen(); return __first; @@ -594,11 +659,15 @@ _OutputIter generate_n(_OutputIter __first, _Size __n, _Generator __gen) { template <class _InputIter, class _OutputIter, class _Tp> _OutputIter remove_copy(_InputIter __first, _InputIter __last, - _OutputIter __result, const _Tp& __value) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, - typename iterator_traits<_InputIter>::value_type, _Tp); + _OutputIter __result, const _Tp& __value) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter>::value_type>); + glibcpp_function_requires(EqualOpConcept< + typename iterator_traits<_InputIter>::value_type, _Tp>); + for ( ; __first != __last; ++__first) if (!(*__first == __value)) { *__result = *__first; @@ -609,11 +678,15 @@ _OutputIter remove_copy(_InputIter __first, _InputIter __last, template <class _InputIter, class _OutputIter, class _Predicate> _OutputIter remove_copy_if(_InputIter __first, _InputIter __last, - _OutputIter __result, _Predicate __pred) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, - typename iterator_traits<_InputIter>::value_type); + _OutputIter __result, _Predicate __pred) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter>::value_type>); + glibcpp_function_requires(UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIter>::value_type>); + for ( ; __first != __last; ++__first) if (!__pred(*__first)) { *__result = *__first; @@ -624,11 +697,15 @@ _OutputIter remove_copy_if(_InputIter __first, _InputIter __last, template <class _ForwardIter, class _Tp> _ForwardIter remove(_ForwardIter __first, _ForwardIter __last, - const _Tp& __value) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); - __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, - typename iterator_traits<_ForwardIter>::value_type, _Tp); - __STL_CONVERTIBLE(_Tp, typename iterator_traits<_ForwardIter>::value_type); + const _Tp& __value) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(ConvertibleConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(EqualOpConcept< + typename iterator_traits<_ForwardIter>::value_type, _Tp>); + __first = find(__first, __last, __value); _ForwardIter __i = __first; return __first == __last ? __first @@ -637,10 +714,13 @@ _ForwardIter remove(_ForwardIter __first, _ForwardIter __last, template <class _ForwardIter, class _Predicate> _ForwardIter remove_if(_ForwardIter __first, _ForwardIter __last, - _Predicate __pred) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); - __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, - typename iterator_traits<_ForwardIter>::value_type); + _Predicate __pred) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(UnaryPredicateConcept<_Predicate, + typename iterator_traits<_ForwardIter>::value_type>); + __first = find_if(__first, __last, __pred); _ForwardIter __i = __first; return __first == __last ? __first @@ -651,7 +731,9 @@ _ForwardIter remove_if(_ForwardIter __first, _ForwardIter __last, template <class _InputIter, class _OutputIter, class _Tp> _OutputIter __unique_copy(_InputIter __first, _InputIter __last, - _OutputIter __result, _Tp*) { + _OutputIter __result, _Tp*) +{ + // concept requirements -- taken care of in dispatching function _Tp __value = *__first; *__result = __value; while (++__first != __last) @@ -665,13 +747,17 @@ _OutputIter __unique_copy(_InputIter __first, _InputIter __last, template <class _InputIter, class _OutputIter> inline _OutputIter __unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result, - output_iterator_tag) { - return __unique_copy(__first, __last, __result, __VALUE_TYPE(__first)); + output_iterator_tag) +{ + // concept requirements -- taken care of in dispatching function + return __unique_copy(__first, __last, __result, __value_type(__first)); } template <class _InputIter, class _ForwardIter> _ForwardIter __unique_copy(_InputIter __first, _InputIter __last, - _ForwardIter __result, forward_iterator_tag) { + _ForwardIter __result, forward_iterator_tag) +{ + // concept requirements -- taken care of in dispatching function *__result = *__first; while (++__first != __last) if (!(*__result == *__first)) @@ -681,22 +767,29 @@ _ForwardIter __unique_copy(_InputIter __first, _InputIter __last, template <class _InputIter, class _OutputIter> inline _OutputIter unique_copy(_InputIter __first, _InputIter __last, - _OutputIter __result) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES(typename iterator_traits<_InputIter>::value_type, - _EqualityComparable); + _OutputIter __result) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter>::value_type>); + glibcpp_function_requires(EqualityComparableConcept< + typename iterator_traits<_InputIter>::value_type>); + if (__first == __last) return __result; return __unique_copy(__first, __last, __result, - __ITERATOR_CATEGORY(__result)); + __iterator_category(__result)); } template <class _InputIter, class _OutputIter, class _BinaryPredicate, class _Tp> _OutputIter __unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result, - _BinaryPredicate __binary_pred, _Tp*) { - __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, _Tp, _Tp); + _BinaryPredicate __binary_pred, _Tp*) +{ + // concept requirements -- iterators already checked + glibcpp_function_requires(BinaryPredicateConcept<_BinaryPredicate, _Tp, _Tp>); + _Tp __value = *__first; *__result = __value; while (++__first != __last) @@ -711,19 +804,24 @@ template <class _InputIter, class _OutputIter, class _BinaryPredicate> inline _OutputIter __unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result, _BinaryPredicate __binary_pred, - output_iterator_tag) { + output_iterator_tag) +{ + // concept requirements -- taken care of in dispatching function return __unique_copy(__first, __last, __result, __binary_pred, - __VALUE_TYPE(__first)); + __value_type(__first)); } template <class _InputIter, class _ForwardIter, class _BinaryPredicate> _ForwardIter __unique_copy(_InputIter __first, _InputIter __last, _ForwardIter __result, _BinaryPredicate __binary_pred, - forward_iterator_tag) { - __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, - typename iterator_traits<_ForwardIter>::value_type, - typename iterator_traits<_InputIter>::value_type); + forward_iterator_tag) +{ + // concept requirements -- iterators already checked + glibcpp_function_requires(BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_InputIter>::value_type>); + *__result = *__first; while (++__first != __last) if (!__binary_pred(*__result, *__first)) *++__result = *__first; @@ -733,30 +831,40 @@ _ForwardIter __unique_copy(_InputIter __first, _InputIter __last, template <class _InputIter, class _OutputIter, class _BinaryPredicate> inline _OutputIter unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result, - _BinaryPredicate __binary_pred) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); + _BinaryPredicate __binary_pred) +{ + // concept requirements -- predicates checked later + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter>::value_type>); + if (__first == __last) return __result; return __unique_copy(__first, __last, __result, __binary_pred, - __ITERATOR_CATEGORY(__result)); + __iterator_category(__result)); } template <class _ForwardIter> -_ForwardIter unique(_ForwardIter __first, _ForwardIter __last) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); - __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, - _EqualityComparable); +_ForwardIter unique(_ForwardIter __first, _ForwardIter __last) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(EqualityComparableConcept< + typename iterator_traits<_ForwardIter>::value_type>); + __first = adjacent_find(__first, __last); return unique_copy(__first, __last, __first); } template <class _ForwardIter, class _BinaryPredicate> _ForwardIter unique(_ForwardIter __first, _ForwardIter __last, - _BinaryPredicate __binary_pred) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); - __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, - typename iterator_traits<_ForwardIter>::value_type, - typename iterator_traits<_ForwardIter>::value_type); + _BinaryPredicate __binary_pred) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type>); + __first = adjacent_find(__first, __last, __binary_pred); return unique_copy(__first, __last, __first, __binary_pred); } @@ -781,17 +889,24 @@ void __reverse(_RandomAccessIter __first, _RandomAccessIter __last, } template <class _BidirectionalIter> -inline void reverse(_BidirectionalIter __first, _BidirectionalIter __last) { - __STL_REQUIRES(_BidirectionalIter, _Mutable_BidirectionalIterator); - __reverse(__first, __last, __ITERATOR_CATEGORY(__first)); +inline void reverse(_BidirectionalIter __first, _BidirectionalIter __last) +{ + // concept requirements + glibcpp_function_requires(Mutable_BidirectionalIteratorConcept< + _BidirectionalIter>); + __reverse(__first, __last, __iterator_category(__first)); } template <class _BidirectionalIter, class _OutputIter> _OutputIter reverse_copy(_BidirectionalIter __first, _BidirectionalIter __last, - _OutputIter __result) { - __STL_REQUIRES(_BidirectionalIter, _BidirectionalIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); + _OutputIter __result) +{ + // concept requirements + glibcpp_function_requires(BidirectionalIteratorConcept<_BidirectionalIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_BidirectionalIter>::value_type>); + while (__first != __last) { --__last; *__result = *__last; @@ -819,7 +934,8 @@ _ForwardIter __rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last, _Distance*, - forward_iterator_tag) { + forward_iterator_tag) +{ if (__first == __middle) return __last; if (__last == __middle) @@ -853,8 +969,12 @@ _BidirectionalIter __rotate(_BidirectionalIter __first, _BidirectionalIter __middle, _BidirectionalIter __last, _Distance*, - bidirectional_iterator_tag) { - __STL_REQUIRES(_BidirectionalIter, _Mutable_BidirectionalIterator); + bidirectional_iterator_tag) +{ + // concept requirements + glibcpp_function_requires(Mutable_BidirectionalIteratorConcept< + _BidirectionalIter>); + if (__first == __middle) return __last; if (__last == __middle) @@ -880,8 +1000,12 @@ template <class _RandomAccessIter, class _Distance, class _Tp> _RandomAccessIter __rotate(_RandomAccessIter __first, _RandomAccessIter __middle, _RandomAccessIter __last, - _Distance *, _Tp *) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + _Distance *, _Tp *) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + _Distance __n = __last - __first; _Distance __k = __middle - __first; _Distance __l = __n - __k; @@ -934,18 +1058,25 @@ _RandomAccessIter __rotate(_RandomAccessIter __first, template <class _ForwardIter> inline _ForwardIter rotate(_ForwardIter __first, _ForwardIter __middle, - _ForwardIter __last) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + _ForwardIter __last) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + return __rotate(__first, __middle, __last, - __DISTANCE_TYPE(__first), - __ITERATOR_CATEGORY(__first)); + __distance_type(__first), + __iterator_category(__first)); } template <class _ForwardIter, class _OutputIter> _OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle, - _ForwardIter __last, _OutputIter __result) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); + _ForwardIter __last, _OutputIter __result) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_ForwardIter>::value_type>); + return copy(__first, __middle, copy(__middle, __last, __result)); } @@ -966,8 +1097,12 @@ inline _Distance __random_number(_Distance __n) { template <class _RandomAccessIter> inline void random_shuffle(_RandomAccessIter __first, - _RandomAccessIter __last) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + _RandomAccessIter __last) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + if (__first == __last) return; for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) iter_swap(__i, __first + __random_number((__i - __first) + 1)); @@ -975,8 +1110,12 @@ inline void random_shuffle(_RandomAccessIter __first, template <class _RandomAccessIter, class _RandomNumberGenerator> void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last, - _RandomNumberGenerator& __rand) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + _RandomNumberGenerator& __rand) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + if (__first == __last) return; for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) iter_swap(__i, __first + __rand((__i - __first) + 1)); @@ -988,8 +1127,11 @@ template <class _ForwardIter, class _OutputIter, class _Distance> _OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, _OutputIter __out, const _Distance __n) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_ForwardIter>::value_type>); + _Distance __remaining = 0; distance(__first, __last, __remaining); _Distance __m = min(__n, __remaining); @@ -1013,9 +1155,13 @@ _OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, _OutputIter __out, const _Distance __n, _RandomNumberGenerator& __rand) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_UNARY_FUNCTION_CHECK(_RandomNumberGenerator, _Distance, _Distance); + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(UnaryFunctionConcept< + _RandomNumberGenerator, _Distance, _Distance>); + _Distance __remaining = 0; distance(__first, __last, __remaining); _Distance __m = min(__n, __remaining); @@ -1061,7 +1207,10 @@ _RandomAccessIter __random_sample(_InputIter __first, _InputIter __last, _RandomNumberGenerator& __rand, const _Distance __n) { - __STL_UNARY_FUNCTION_CHECK(_RandomNumberGenerator, _Distance, _Distance); + // concept requirements + glibcpp_function_requires(UnaryFunctionConcept< + _RandomNumberGenerator, _Distance, _Distance>); + _Distance __m = 0; _Distance __t = __n; for ( ; __first != __last && __m < __n; ++__m, ++__first) @@ -1083,8 +1232,11 @@ inline _RandomAccessIter random_sample(_InputIter __first, _InputIter __last, _RandomAccessIter __out_first, _RandomAccessIter __out_last) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + return __random_sample(__first, __last, __out_first, __out_last - __out_first); } @@ -1097,8 +1249,11 @@ random_sample(_InputIter __first, _InputIter __last, _RandomAccessIter __out_first, _RandomAccessIter __out_last, _RandomNumberGenerator& __rand) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + return __random_sample(__first, __last, __out_first, __rand, __out_last - __out_first); @@ -1110,7 +1265,8 @@ template <class _ForwardIter, class _Predicate> _ForwardIter __partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, - forward_iterator_tag) { + forward_iterator_tag) +{ if (__first == __last) return __first; while (__pred(*__first)) @@ -1131,7 +1287,8 @@ template <class _BidirectionalIter, class _Predicate> _BidirectionalIter __partition(_BidirectionalIter __first, _BidirectionalIter __last, _Predicate __pred, - bidirectional_iterator_tag) { + bidirectional_iterator_tag) +{ while (true) { while (true) if (__first == __last) @@ -1156,18 +1313,22 @@ _BidirectionalIter __partition(_BidirectionalIter __first, template <class _ForwardIter, class _Predicate> inline _ForwardIter partition(_ForwardIter __first, _ForwardIter __last, - _Predicate __pred) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); - __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, - typename iterator_traits<_ForwardIter>::value_type); - return __partition(__first, __last, __pred, __ITERATOR_CATEGORY(__first)); + _Predicate __pred) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(UnaryPredicateConcept<_Predicate, + typename iterator_traits<_ForwardIter>::value_type>); + + return __partition(__first, __last, __pred, __iterator_category(__first)); } template <class _ForwardIter, class _Predicate, class _Distance> _ForwardIter __inplace_stable_partition(_ForwardIter __first, _ForwardIter __last, - _Predicate __pred, _Distance __len) { + _Predicate __pred, _Distance __len) +{ if (__len == 1) return __pred(*__first) ? __last : __first; _ForwardIter __middle = __first; @@ -1233,16 +1394,19 @@ __stable_partition_aux(_ForwardIter __first, _ForwardIter __last, template <class _ForwardIter, class _Predicate> inline _ForwardIter stable_partition(_ForwardIter __first, _ForwardIter __last, - _Predicate __pred) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); - __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, - typename iterator_traits<_ForwardIter>::value_type); + _Predicate __pred) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(UnaryPredicateConcept<_Predicate, + typename iterator_traits<_ForwardIter>::value_type>); + if (__first == __last) return __first; else return __stable_partition_aux(__first, __last, __pred, - __VALUE_TYPE(__first), - __DISTANCE_TYPE(__first)); + __value_type(__first), + __distance_type(__first)); } template <class _RandomAccessIter, class _Tp> @@ -1286,7 +1450,8 @@ const int __stl_threshold = 16; // sort() and its auxiliary functions. template <class _RandomAccessIter, class _Tp> -void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val) { +void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val) +{ _RandomAccessIter __next = __last; --__next; while (__val < *__next) { @@ -1299,7 +1464,8 @@ void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val) { template <class _RandomAccessIter, class _Tp, class _Compare> void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val, - _Compare __comp) { + _Compare __comp) +{ _RandomAccessIter __next = __last; --__next; while (__comp(__val, *__next)) { @@ -1312,7 +1478,8 @@ void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val, template <class _RandomAccessIter, class _Tp> inline void __linear_insert(_RandomAccessIter __first, - _RandomAccessIter __last, _Tp*) { + _RandomAccessIter __last, _Tp*) +{ _Tp __val = *__last; if (__val < *__first) { copy_backward(__first, __last, __last + 1); @@ -1324,7 +1491,8 @@ inline void __linear_insert(_RandomAccessIter __first, template <class _RandomAccessIter, class _Tp, class _Compare> inline void __linear_insert(_RandomAccessIter __first, - _RandomAccessIter __last, _Tp*, _Compare __comp) { + _RandomAccessIter __last, _Tp*, _Compare __comp) +{ _Tp __val = *__last; if (__comp(__val, *__first)) { copy_backward(__first, __last, __last + 1); @@ -1335,23 +1503,26 @@ inline void __linear_insert(_RandomAccessIter __first, } template <class _RandomAccessIter> -void __insertion_sort(_RandomAccessIter __first, _RandomAccessIter __last) { +void __insertion_sort(_RandomAccessIter __first, _RandomAccessIter __last) +{ if (__first == __last) return; for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) - __linear_insert(__first, __i, __VALUE_TYPE(__first)); + __linear_insert(__first, __i, __value_type(__first)); } template <class _RandomAccessIter, class _Compare> void __insertion_sort(_RandomAccessIter __first, - _RandomAccessIter __last, _Compare __comp) { + _RandomAccessIter __last, _Compare __comp) +{ if (__first == __last) return; for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) - __linear_insert(__first, __i, __VALUE_TYPE(__first), __comp); + __linear_insert(__first, __i, __value_type(__first), __comp); } template <class _RandomAccessIter, class _Tp> void __unguarded_insertion_sort_aux(_RandomAccessIter __first, - _RandomAccessIter __last, _Tp*) { + _RandomAccessIter __last, _Tp*) +{ for (_RandomAccessIter __i = __first; __i != __last; ++__i) __unguarded_linear_insert(__i, _Tp(*__i)); } @@ -1359,13 +1530,14 @@ void __unguarded_insertion_sort_aux(_RandomAccessIter __first, template <class _RandomAccessIter> inline void __unguarded_insertion_sort(_RandomAccessIter __first, _RandomAccessIter __last) { - __unguarded_insertion_sort_aux(__first, __last, __VALUE_TYPE(__first)); + __unguarded_insertion_sort_aux(__first, __last, __value_type(__first)); } template <class _RandomAccessIter, class _Tp, class _Compare> void __unguarded_insertion_sort_aux(_RandomAccessIter __first, _RandomAccessIter __last, - _Tp*, _Compare __comp) { + _Tp*, _Compare __comp) +{ for (_RandomAccessIter __i = __first; __i != __last; ++__i) __unguarded_linear_insert(__i, _Tp(*__i), __comp); } @@ -1373,14 +1545,16 @@ void __unguarded_insertion_sort_aux(_RandomAccessIter __first, template <class _RandomAccessIter, class _Compare> inline void __unguarded_insertion_sort(_RandomAccessIter __first, _RandomAccessIter __last, - _Compare __comp) { - __unguarded_insertion_sort_aux(__first, __last, __VALUE_TYPE(__first), + _Compare __comp) +{ + __unguarded_insertion_sort_aux(__first, __last, __value_type(__first), __comp); } template <class _RandomAccessIter> void __final_insertion_sort(_RandomAccessIter __first, - _RandomAccessIter __last) { + _RandomAccessIter __last) +{ if (__last - __first > __stl_threshold) { __insertion_sort(__first, __first + __stl_threshold); __unguarded_insertion_sort(__first + __stl_threshold, __last); @@ -1391,7 +1565,8 @@ void __final_insertion_sort(_RandomAccessIter __first, template <class _RandomAccessIter, class _Compare> void __final_insertion_sort(_RandomAccessIter __first, - _RandomAccessIter __last, _Compare __comp) { + _RandomAccessIter __last, _Compare __comp) +{ if (__last - __first > __stl_threshold) { __insertion_sort(__first, __first + __stl_threshold, __comp); __unguarded_insertion_sort(__first + __stl_threshold, __last, __comp); @@ -1401,7 +1576,8 @@ void __final_insertion_sort(_RandomAccessIter __first, } template <class _Size> -inline _Size __lg(_Size __n) { +inline _Size __lg(_Size __n) +{ _Size __k; for (__k = 0; __n != 1; __n >>= 1) ++__k; return __k; @@ -1451,13 +1627,17 @@ void __introsort_loop(_RandomAccessIter __first, } template <class _RandomAccessIter> -inline void sort(_RandomAccessIter __first, _RandomAccessIter __last) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); - __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, - _LessThanComparable); +inline void sort(_RandomAccessIter __first, _RandomAccessIter __last) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_RandomAccessIter>::value_type>); + if (__first != __last) { __introsort_loop(__first, __last, - __VALUE_TYPE(__first), + __value_type(__first), __lg(__last - __first) * 2); __final_insertion_sort(__first, __last); } @@ -1465,14 +1645,18 @@ inline void sort(_RandomAccessIter __first, _RandomAccessIter __last) { template <class _RandomAccessIter, class _Compare> inline void sort(_RandomAccessIter __first, _RandomAccessIter __last, - _Compare __comp) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_RandomAccessIter>::value_type, - typename iterator_traits<_RandomAccessIter>::value_type); + _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type>); + if (__first != __last) { __introsort_loop(__first, __last, - __VALUE_TYPE(__first), + __value_type(__first), __lg(__last - __first) * 2, __comp); __final_insertion_sort(__first, __last, __comp); @@ -1483,7 +1667,8 @@ inline void sort(_RandomAccessIter __first, _RandomAccessIter __last, template <class _RandomAccessIter> void __inplace_stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last) { + _RandomAccessIter __last) +{ if (__last - __first < 15) { __insertion_sort(__first, __last); return; @@ -1498,7 +1683,8 @@ void __inplace_stable_sort(_RandomAccessIter __first, template <class _RandomAccessIter, class _Compare> void __inplace_stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last, _Compare __comp) { + _RandomAccessIter __last, _Compare __comp) +{ if (__last - __first < 15) { __insertion_sort(__first, __last, __comp); return; @@ -1516,7 +1702,8 @@ template <class _RandomAccessIter1, class _RandomAccessIter2, class _Distance> void __merge_sort_loop(_RandomAccessIter1 __first, _RandomAccessIter1 __last, - _RandomAccessIter2 __result, _Distance __step_size) { + _RandomAccessIter2 __result, _Distance __step_size) +{ _Distance __two_step = 2 * __step_size; while (__last - __first >= __two_step) { @@ -1536,7 +1723,8 @@ template <class _RandomAccessIter1, class _RandomAccessIter2, void __merge_sort_loop(_RandomAccessIter1 __first, _RandomAccessIter1 __last, _RandomAccessIter2 __result, _Distance __step_size, - _Compare __comp) { + _Compare __comp) +{ _Distance __two_step = 2 * __step_size; while (__last - __first >= __two_step) { @@ -1582,7 +1770,8 @@ void __chunk_insertion_sort(_RandomAccessIter __first, template <class _RandomAccessIter, class _Pointer, class _Distance> void __merge_sort_with_buffer(_RandomAccessIter __first, _RandomAccessIter __last, - _Pointer __buffer, _Distance*) { + _Pointer __buffer, _Distance*) +{ _Distance __len = __last - __first; _Pointer __buffer_last = __buffer + __len; @@ -1601,7 +1790,8 @@ template <class _RandomAccessIter, class _Pointer, class _Distance, class _Compare> void __merge_sort_with_buffer(_RandomAccessIter __first, _RandomAccessIter __last, _Pointer __buffer, - _Distance*, _Compare __comp) { + _Distance*, _Compare __comp) +{ _Distance __len = __last - __first; _Pointer __buffer_last = __buffer + __len; @@ -1619,7 +1809,8 @@ void __merge_sort_with_buffer(_RandomAccessIter __first, template <class _RandomAccessIter, class _Pointer, class _Distance> void __stable_sort_adaptive(_RandomAccessIter __first, _RandomAccessIter __last, _Pointer __buffer, - _Distance __buffer_size) { + _Distance __buffer_size) +{ _Distance __len = (__last - __first + 1) / 2; _RandomAccessIter __middle = __first + __len; if (__len > __buffer_size) { @@ -1638,7 +1829,8 @@ template <class _RandomAccessIter, class _Pointer, class _Distance, class _Compare> void __stable_sort_adaptive(_RandomAccessIter __first, _RandomAccessIter __last, _Pointer __buffer, - _Distance __buffer_size, _Compare __comp) { + _Distance __buffer_size, _Compare __comp) +{ _Distance __len = (__last - __first + 1) / 2; _RandomAccessIter __middle = __first + __len; if (__len > __buffer_size) { @@ -1660,7 +1852,8 @@ void __stable_sort_adaptive(_RandomAccessIter __first, template <class _RandomAccessIter, class _Tp, class _Distance> inline void __stable_sort_aux(_RandomAccessIter __first, - _RandomAccessIter __last, _Tp*, _Distance*) { + _RandomAccessIter __last, _Tp*, _Distance*) +{ _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last); if (buf.begin() == 0) __inplace_stable_sort(__first, __last); @@ -1672,7 +1865,8 @@ inline void __stable_sort_aux(_RandomAccessIter __first, template <class _RandomAccessIter, class _Tp, class _Distance, class _Compare> inline void __stable_sort_aux(_RandomAccessIter __first, _RandomAccessIter __last, _Tp*, _Distance*, - _Compare __comp) { + _Compare __comp) +{ _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last); if (buf.begin() == 0) __inplace_stable_sort(__first, __last, __comp); @@ -1684,25 +1878,33 @@ inline void __stable_sort_aux(_RandomAccessIter __first, template <class _RandomAccessIter> inline void stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); - __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, - _LessThanComparable); + _RandomAccessIter __last) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_RandomAccessIter>::value_type>); + __stable_sort_aux(__first, __last, - __VALUE_TYPE(__first), - __DISTANCE_TYPE(__first)); + __value_type(__first), + __distance_type(__first)); } template <class _RandomAccessIter, class _Compare> inline void stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last, _Compare __comp) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_RandomAccessIter>::value_type, - typename iterator_traits<_RandomAccessIter>::value_type); + _RandomAccessIter __last, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type>); + __stable_sort_aux(__first, __last, - __VALUE_TYPE(__first), - __DISTANCE_TYPE(__first), + __value_type(__first), + __distance_type(__first), __comp); } @@ -1710,45 +1912,55 @@ inline void stable_sort(_RandomAccessIter __first, template <class _RandomAccessIter, class _Tp> void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, - _RandomAccessIter __last, _Tp*) { + _RandomAccessIter __last, _Tp*) +{ make_heap(__first, __middle); for (_RandomAccessIter __i = __middle; __i < __last; ++__i) if (*__i < *__first) __pop_heap(__first, __middle, __i, _Tp(*__i), - __DISTANCE_TYPE(__first)); + __distance_type(__first)); sort_heap(__first, __middle); } template <class _RandomAccessIter> inline void partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, - _RandomAccessIter __last) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); - __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, - _LessThanComparable); - __partial_sort(__first, __middle, __last, __VALUE_TYPE(__first)); + _RandomAccessIter __last) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_RandomAccessIter>::value_type>); + + __partial_sort(__first, __middle, __last, __value_type(__first)); } template <class _RandomAccessIter, class _Tp, class _Compare> void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, - _RandomAccessIter __last, _Tp*, _Compare __comp) { + _RandomAccessIter __last, _Tp*, _Compare __comp) +{ make_heap(__first, __middle, __comp); for (_RandomAccessIter __i = __middle; __i < __last; ++__i) if (__comp(*__i, *__first)) __pop_heap(__first, __middle, __i, _Tp(*__i), __comp, - __DISTANCE_TYPE(__first)); + __distance_type(__first)); sort_heap(__first, __middle, __comp); } template <class _RandomAccessIter, class _Compare> inline void partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, - _RandomAccessIter __last, _Compare __comp) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_RandomAccessIter>::value_type, - typename iterator_traits<_RandomAccessIter>::value_type); - __partial_sort(__first, __middle, __last, __VALUE_TYPE(__first), __comp); + _RandomAccessIter __last, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type>); + + __partial_sort(__first, __middle, __last, __value_type(__first), __comp); } template <class _InputIter, class _RandomAccessIter, class _Distance, @@ -1757,7 +1969,8 @@ _RandomAccessIter __partial_sort_copy(_InputIter __first, _InputIter __last, _RandomAccessIter __result_first, _RandomAccessIter __result_last, - _Distance*, _Tp*) { + _Distance*, _Tp*) +{ if (__result_first == __result_last) return __result_last; _RandomAccessIter __result_real_last = __result_first; while(__first != __last && __result_real_last != __result_last) { @@ -1781,18 +1994,21 @@ template <class _InputIter, class _RandomAccessIter> inline _RandomAccessIter partial_sort_copy(_InputIter __first, _InputIter __last, _RandomAccessIter __result_first, - _RandomAccessIter __result_last) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); - __STL_CONVERTIBLE(typename iterator_traits<_InputIter>::value_type, - typename iterator_traits<_RandomAccessIter>::value_type); - __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, - _LessThanComparable); - __STL_REQUIRES(typename iterator_traits<_InputIter>::value_type, - _LessThanComparable); + _RandomAccessIter __result_last) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(ConvertibleConcept< + typename iterator_traits<_InputIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_RandomAccessIter>::value_type>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter>::value_type>); + return __partial_sort_copy(__first, __last, __result_first, __result_last, - __DISTANCE_TYPE(__result_first), - __VALUE_TYPE(__first)); + __distance_type(__result_first), + __value_type(__first)); } template <class _InputIter, class _RandomAccessIter, class _Compare, @@ -1801,7 +2017,8 @@ _RandomAccessIter __partial_sort_copy(_InputIter __first, _InputIter __last, _RandomAccessIter __result_first, _RandomAccessIter __result_last, - _Compare __comp, _Distance*, _Tp*) { + _Compare __comp, _Distance*, _Tp*) +{ if (__result_first == __result_last) return __result_last; _RandomAccessIter __result_real_last = __result_first; while(__first != __last && __result_real_last != __result_last) { @@ -1826,25 +2043,31 @@ template <class _InputIter, class _RandomAccessIter, class _Compare> inline _RandomAccessIter partial_sort_copy(_InputIter __first, _InputIter __last, _RandomAccessIter __result_first, - _RandomAccessIter __result_last, _Compare __comp) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); - __STL_CONVERTIBLE(typename iterator_traits<_InputIter>::value_type, - typename iterator_traits<_RandomAccessIter>::value_type); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_RandomAccessIter>::value_type, - typename iterator_traits<_RandomAccessIter>::value_type); + _RandomAccessIter __result_last, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + glibcpp_function_requires(ConvertibleConcept< + typename iterator_traits<_InputIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type>); + return __partial_sort_copy(__first, __last, __result_first, __result_last, __comp, - __DISTANCE_TYPE(__result_first), - __VALUE_TYPE(__first)); + __distance_type(__result_first), + __value_type(__first)); } // nth_element() and its auxiliary functions. template <class _RandomAccessIter, class _Tp> void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, - _RandomAccessIter __last, _Tp*) { + _RandomAccessIter __last, _Tp*) +{ while (__last - __first > 3) { _RandomAccessIter __cut = __unguarded_partition(__first, __last, @@ -1861,16 +2084,21 @@ void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, template <class _RandomAccessIter> inline void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, - _RandomAccessIter __last) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); - __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, - _LessThanComparable); - __nth_element(__first, __nth, __last, __VALUE_TYPE(__first)); + _RandomAccessIter __last) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_RandomAccessIter>::value_type>); + + __nth_element(__first, __nth, __last, __value_type(__first)); } template <class _RandomAccessIter, class _Tp, class _Compare> void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, - _RandomAccessIter __last, _Tp*, _Compare __comp) { + _RandomAccessIter __last, _Tp*, _Compare __comp) +{ while (__last - __first > 3) { _RandomAccessIter __cut = __unguarded_partition(__first, __last, @@ -1889,12 +2117,16 @@ void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, template <class _RandomAccessIter, class _Compare> inline void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, - _RandomAccessIter __last, _Compare __comp) { - __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_RandomAccessIter>::value_type, - typename iterator_traits<_RandomAccessIter>::value_type); - __nth_element(__first, __nth, __last, __VALUE_TYPE(__first), __comp); + _RandomAccessIter __last, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIter>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type>); + + __nth_element(__first, __nth, __last, __value_type(__first), __comp); } @@ -1926,13 +2158,16 @@ _ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, template <class _ForwardIter, class _Tp> inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES_SAME_TYPE(_Tp, - typename iterator_traits<_ForwardIter>::value_type); - __STL_REQUIRES(_Tp, _LessThanComparable); + const _Tp& __val) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(SameTypeConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(LessThanComparableConcept<_Tp>); + return __lower_bound(__first, __last, __val, - __DISTANCE_TYPE(__first)); + __distance_type(__first)); } template <class _ForwardIter, class _Tp, class _Compare, class _Distance> @@ -1961,13 +2196,16 @@ _ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, template <class _ForwardIter, class _Tp, class _Compare> inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val, _Compare __comp) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES_SAME_TYPE(_Tp, - typename iterator_traits<_ForwardIter>::value_type); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + const _Tp& __val, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(SameTypeConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, _Tp, _Tp>); + return __lower_bound(__first, __last, __val, __comp, - __DISTANCE_TYPE(__first)); + __distance_type(__first)); } template <class _ForwardIter, class _Tp, class _Distance> @@ -1996,13 +2234,16 @@ _ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, template <class _ForwardIter, class _Tp> inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES_SAME_TYPE(_Tp, - typename iterator_traits<_ForwardIter>::value_type); - __STL_REQUIRES(_Tp, _LessThanComparable); + const _Tp& __val) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(SameTypeConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(LessThanComparableConcept<_Tp>); + return __upper_bound(__first, __last, __val, - __DISTANCE_TYPE(__first)); + __distance_type(__first)); } template <class _ForwardIter, class _Tp, class _Compare, class _Distance> @@ -2031,13 +2272,16 @@ _ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, template <class _ForwardIter, class _Tp, class _Compare> inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val, _Compare __comp) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES_SAME_TYPE(_Tp, - typename iterator_traits<_ForwardIter>::value_type); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + const _Tp& __val, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(SameTypeConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, _Tp, _Tp>); + return __upper_bound(__first, __last, __val, __comp, - __DISTANCE_TYPE(__first)); + __distance_type(__first)); } template <class _ForwardIter, class _Tp, class _Distance> @@ -2073,13 +2317,16 @@ __equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, template <class _ForwardIter, class _Tp> inline pair<_ForwardIter, _ForwardIter> -equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES_SAME_TYPE(_Tp, - typename iterator_traits<_ForwardIter>::value_type); - __STL_REQUIRES(_Tp, _LessThanComparable); +equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(SameTypeConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(LessThanComparableConcept<_Tp>); + return __equal_range(__first, __last, __val, - __DISTANCE_TYPE(__first)); + __distance_type(__first)); } template <class _ForwardIter, class _Tp, class _Compare, class _Distance> @@ -2116,22 +2363,28 @@ __equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, template <class _ForwardIter, class _Tp, class _Compare> inline pair<_ForwardIter, _ForwardIter> equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, - _Compare __comp) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES_SAME_TYPE(_Tp, - typename iterator_traits<_ForwardIter>::value_type); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(SameTypeConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, _Tp, _Tp>); + return __equal_range(__first, __last, __val, __comp, - __DISTANCE_TYPE(__first)); + __distance_type(__first)); } template <class _ForwardIter, class _Tp> bool binary_search(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES_SAME_TYPE(_Tp, - typename iterator_traits<_ForwardIter>::value_type); - __STL_REQUIRES(_Tp, _LessThanComparable); + const _Tp& __val) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(SameTypeConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(LessThanComparableConcept<_Tp>); + _ForwardIter __i = lower_bound(__first, __last, __val); return __i != __last && !(__val < *__i); } @@ -2139,11 +2392,14 @@ bool binary_search(_ForwardIter __first, _ForwardIter __last, template <class _ForwardIter, class _Tp, class _Compare> bool binary_search(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, - _Compare __comp) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES_SAME_TYPE(_Tp, - typename iterator_traits<_ForwardIter>::value_type); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(SameTypeConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, _Tp, _Tp>); + _ForwardIter __i = lower_bound(__first, __last, __val, __comp); return __i != __last && !__comp(__val, *__i); } @@ -2153,15 +2409,19 @@ bool binary_search(_ForwardIter __first, _ForwardIter __last, template <class _InputIter1, class _InputIter2, class _OutputIter> _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, - _LessThanComparable); + _OutputIter __result) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter1>::value_type>); + while (__first1 != __last1 && __first2 != __last2) { if (*__first2 < *__first1) { *__result = *__first2; @@ -2180,16 +2440,20 @@ template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare> _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter1>::value_type); + _OutputIter __result, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + while (__first1 != __last1 && __first2 != __last2) { if (__comp(*__first2, *__first1)) { *__result = *__first2; @@ -2210,7 +2474,8 @@ template <class _BidirectionalIter, class _Distance> void __merge_without_buffer(_BidirectionalIter __first, _BidirectionalIter __middle, _BidirectionalIter __last, - _Distance __len1, _Distance __len2) { + _Distance __len1, _Distance __len2) +{ if (__len1 == 0 || __len2 == 0) return; if (__len1 + __len2 == 2) { @@ -2247,7 +2512,8 @@ void __merge_without_buffer(_BidirectionalIter __first, _BidirectionalIter __middle, _BidirectionalIter __last, _Distance __len1, _Distance __len2, - _Compare __comp) { + _Compare __comp) +{ if (__len1 == 0 || __len2 == 0) return; if (__len1 + __len2 == 2) { @@ -2286,7 +2552,8 @@ _BidirectionalIter1 __rotate_adaptive(_BidirectionalIter1 __first, _BidirectionalIter1 __last, _Distance __len1, _Distance __len2, _BidirectionalIter2 __buffer, - _Distance __buffer_size) { + _Distance __buffer_size) +{ _BidirectionalIter2 __buffer_end; if (__len1 > __len2 && __len2 <= __buffer_size) { __buffer_end = copy(__middle, __last, __buffer); @@ -2308,7 +2575,8 @@ _BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1, _BidirectionalIter2 __first2, _BidirectionalIter2 __last2, - _BidirectionalIter3 __result) { + _BidirectionalIter3 __result) +{ if (__first1 == __last1) return copy_backward(__first2, __last2, __result); if (__first2 == __last2) @@ -2338,7 +2606,8 @@ _BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1, _BidirectionalIter2 __first2, _BidirectionalIter2 __last2, _BidirectionalIter3 __result, - _Compare __comp) { + _Compare __comp) +{ if (__first1 == __last1) return copy_backward(__first2, __last2, __result); if (__first2 == __last2) @@ -2366,7 +2635,8 @@ void __merge_adaptive(_BidirectionalIter __first, _BidirectionalIter __middle, _BidirectionalIter __last, _Distance __len1, _Distance __len2, - _Pointer __buffer, _Distance __buffer_size) { + _Pointer __buffer, _Distance __buffer_size) +{ if (__len1 <= __len2 && __len1 <= __buffer_size) { _Pointer __buffer_end = copy(__first, __middle, __buffer); merge(__buffer, __buffer_end, __middle, __last, __first); @@ -2409,7 +2679,8 @@ void __merge_adaptive(_BidirectionalIter __first, _BidirectionalIter __last, _Distance __len1, _Distance __len2, _Pointer __buffer, _Distance __buffer_size, - _Compare __comp) { + _Compare __comp) +{ if (__len1 <= __len2 && __len1 <= __buffer_size) { _Pointer __buffer_end = copy(__first, __middle, __buffer); merge(__buffer, __buffer_end, __middle, __last, __first, __comp); @@ -2449,7 +2720,8 @@ void __merge_adaptive(_BidirectionalIter __first, template <class _BidirectionalIter, class _Tp, class _Distance> inline void __inplace_merge_aux(_BidirectionalIter __first, _BidirectionalIter __middle, - _BidirectionalIter __last, _Tp*, _Distance*) { + _BidirectionalIter __last, _Tp*, _Distance*) +{ _Distance __len1 = 0; distance(__first, __middle, __len1); _Distance __len2 = 0; @@ -2468,7 +2740,8 @@ template <class _BidirectionalIter, class _Tp, inline void __inplace_merge_aux(_BidirectionalIter __first, _BidirectionalIter __middle, _BidirectionalIter __last, _Tp*, _Distance*, - _Compare __comp) { + _Compare __comp) +{ _Distance __len1 = 0; distance(__first, __middle, __len1); _Distance __len2 = 0; @@ -2486,28 +2759,36 @@ inline void __inplace_merge_aux(_BidirectionalIter __first, template <class _BidirectionalIter> inline void inplace_merge(_BidirectionalIter __first, _BidirectionalIter __middle, - _BidirectionalIter __last) { - __STL_REQUIRES(_BidirectionalIter, _Mutable_BidirectionalIterator); - __STL_REQUIRES(typename iterator_traits<_BidirectionalIter>::value_type, - _LessThanComparable); + _BidirectionalIter __last) +{ + // concept requirements + glibcpp_function_requires(Mutable_BidirectionalIteratorConcept< + _BidirectionalIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_BidirectionalIter>::value_type>); + if (__first == __middle || __middle == __last) return; __inplace_merge_aux(__first, __middle, __last, - __VALUE_TYPE(__first), __DISTANCE_TYPE(__first)); + __value_type(__first), __distance_type(__first)); } template <class _BidirectionalIter, class _Compare> inline void inplace_merge(_BidirectionalIter __first, _BidirectionalIter __middle, - _BidirectionalIter __last, _Compare __comp) { - __STL_REQUIRES(_BidirectionalIter, _Mutable_BidirectionalIterator); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_BidirectionalIter>::value_type, - typename iterator_traits<_BidirectionalIter>::value_type); + _BidirectionalIter __last, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(Mutable_BidirectionalIteratorConcept< + _BidirectionalIter>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_BidirectionalIter>::value_type, + typename iterator_traits<_BidirectionalIter>::value_type>); + if (__first == __middle || __middle == __last) return; __inplace_merge_aux(__first, __middle, __last, - __VALUE_TYPE(__first), __DISTANCE_TYPE(__first), + __value_type(__first), __distance_type(__first), __comp); } @@ -2518,14 +2799,17 @@ inline void inplace_merge(_BidirectionalIter __first, template <class _InputIter1, class _InputIter2> bool includes(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, - _LessThanComparable); + _InputIter2 __first2, _InputIter2 __last2) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter1>::value_type>); + while (__first1 != __last1 && __first2 != __last2) if (*__first2 < *__first1) return false; @@ -2539,15 +2823,18 @@ bool includes(_InputIter1 __first1, _InputIter1 __last1, template <class _InputIter1, class _InputIter2, class _Compare> bool includes(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); + _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first2, *__first1)) return false; @@ -2562,15 +2849,19 @@ bool includes(_InputIter1 __first1, _InputIter1 __last1, template <class _InputIter1, class _InputIter2, class _OutputIter> _OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, - _LessThanComparable); + _OutputIter __result) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter1>::value_type>); + while (__first1 != __last1 && __first2 != __last2) { if (*__first1 < *__first2) { *__result = *__first1; @@ -2594,16 +2885,20 @@ template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare> _OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); + _OutputIter __result, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + while (__first1 != __last1 && __first2 != __last2) { if (__comp(*__first1, *__first2)) { *__result = *__first1; @@ -2626,15 +2921,19 @@ _OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, template <class _InputIter1, class _InputIter2, class _OutputIter> _OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, - _LessThanComparable); + _OutputIter __result) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter1>::value_type>); + while (__first1 != __last1 && __first2 != __last2) if (*__first1 < *__first2) ++__first1; @@ -2653,16 +2952,19 @@ template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare> _OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); + _OutputIter __result, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first1, *__first2)) @@ -2681,15 +2983,19 @@ _OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, template <class _InputIter1, class _InputIter2, class _OutputIter> _OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, - _LessThanComparable); + _OutputIter __result) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter1>::value_type>); + while (__first1 != __last1 && __first2 != __last2) if (*__first1 < *__first2) { *__result = *__first1; @@ -2709,16 +3015,19 @@ template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare> _OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); + _OutputIter __result, _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first1, *__first2)) { @@ -2739,15 +3048,19 @@ template <class _InputIter1, class _InputIter2, class _OutputIter> _OutputIter set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, - _LessThanComparable); + _OutputIter __result) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter1>::value_type>); + while (__first1 != __last1 && __first2 != __last2) if (*__first1 < *__first2) { *__result = *__first1; @@ -2772,16 +3085,20 @@ _OutputIter set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result, - _Compare __comp) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); - __STL_REQUIRES_SAME_TYPE( - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_InputIter1>::value_type, - typename iterator_traits<_InputIter2>::value_type); + _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(SameTypeConcept< + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type>); + while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first1, *__first2)) { *__result = *__first1; @@ -2804,10 +3121,13 @@ set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, // comparison function. template <class _ForwardIter> -_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, - _LessThanComparable); +_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_ForwardIter>::value_type>); + if (__first == __last) return __first; _ForwardIter __result = __first; while (++__first != __last) @@ -2818,11 +3138,14 @@ _ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) { template <class _ForwardIter, class _Compare> _ForwardIter max_element(_ForwardIter __first, _ForwardIter __last, - _Compare __comp) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_ForwardIter>::value_type, - typename iterator_traits<_ForwardIter>::value_type); + _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type>); + if (__first == __last) return __first; _ForwardIter __result = __first; while (++__first != __last) @@ -2831,10 +3154,13 @@ _ForwardIter max_element(_ForwardIter __first, _ForwardIter __last, } template <class _ForwardIter> -_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, - _LessThanComparable); +_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_ForwardIter>::value_type>); + if (__first == __last) return __first; _ForwardIter __result = __first; while (++__first != __last) @@ -2845,11 +3171,14 @@ _ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) { template <class _ForwardIter, class _Compare> _ForwardIter min_element(_ForwardIter __first, _ForwardIter __last, - _Compare __comp) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_ForwardIter>::value_type, - typename iterator_traits<_ForwardIter>::value_type); + _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type>); + if (__first == __last) return __first; _ForwardIter __result = __first; while (++__first != __last) @@ -2862,10 +3191,13 @@ _ForwardIter min_element(_ForwardIter __first, _ForwardIter __last, // supplied comparison function. template <class _BidirectionalIter> -bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) { - __STL_REQUIRES(_BidirectionalIter, _BidirectionalIterator); - __STL_REQUIRES(typename iterator_traits<_BidirectionalIter>::value_type, - _LessThanComparable); +bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) +{ + // concept requirements + glibcpp_function_requires(BidirectionalIteratorConcept<_BidirectionalIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_BidirectionalIter>::value_type>); + if (__first == __last) return false; _BidirectionalIter __i = __first; @@ -2895,11 +3227,14 @@ bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) { template <class _BidirectionalIter, class _Compare> bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last, - _Compare __comp) { - __STL_REQUIRES(_BidirectionalIter, _BidirectionalIterator); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_BidirectionalIter>::value_type, - typename iterator_traits<_BidirectionalIter>::value_type); + _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(BidirectionalIteratorConcept<_BidirectionalIter>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_BidirectionalIter>::value_type, + typename iterator_traits<_BidirectionalIter>::value_type>); + if (__first == __last) return false; _BidirectionalIter __i = __first; @@ -2928,10 +3263,13 @@ bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last, } template <class _BidirectionalIter> -bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) { - __STL_REQUIRES(_BidirectionalIter, _BidirectionalIterator); - __STL_REQUIRES(typename iterator_traits<_BidirectionalIter>::value_type, - _LessThanComparable); +bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) +{ + // concept requirements + glibcpp_function_requires(BidirectionalIteratorConcept<_BidirectionalIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_BidirectionalIter>::value_type>); + if (__first == __last) return false; _BidirectionalIter __i = __first; @@ -2961,11 +3299,14 @@ bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) { template <class _BidirectionalIter, class _Compare> bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last, - _Compare __comp) { - __STL_REQUIRES(_BidirectionalIter, _BidirectionalIterator); - __STL_BINARY_FUNCTION_CHECK(_Compare, bool, - typename iterator_traits<_BidirectionalIter>::value_type, - typename iterator_traits<_BidirectionalIter>::value_type); + _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(BidirectionalIteratorConcept<_BidirectionalIter>); + glibcpp_function_requires(BinaryPredicateConcept<_Compare, + typename iterator_traits<_BidirectionalIter>::value_type, + typename iterator_traits<_BidirectionalIter>::value_type>); + if (__first == __last) return false; _BidirectionalIter __i = __first; @@ -2999,11 +3340,12 @@ template <class _InputIter, class _ForwardIter> _InputIter find_first_of(_InputIter __first1, _InputIter __last1, _ForwardIter __first2, _ForwardIter __last2) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, - typename iterator_traits<_InputIter>::value_type, - typename iterator_traits<_ForwardIter>::value_type); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(EqualOpConcept< + typename iterator_traits<_InputIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type>); for ( ; __first1 != __last1; ++__first1) for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) @@ -3017,11 +3359,15 @@ _InputIter find_first_of(_InputIter __first1, _InputIter __last1, _ForwardIter __first2, _ForwardIter __last2, _BinaryPredicate __comp) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, - typename iterator_traits<_InputIter>::value_type, - typename iterator_traits<_ForwardIter>::value_type); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(EqualOpConcept< + typename iterator_traits<_InputIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type>); + glibcpp_function_requires(BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_InputIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type>); for ( ; __first1 != __last1; ++__first1) for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) @@ -3092,8 +3438,10 @@ __find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1, _BidirectionalIter2 __first2, _BidirectionalIter2 __last2, bidirectional_iterator_tag, bidirectional_iterator_tag) { - __STL_REQUIRES(_BidirectionalIter1, _BidirectionalIterator); - __STL_REQUIRES(_BidirectionalIter2, _BidirectionalIterator); + // concept requirements + glibcpp_function_requires(BidirectionalIteratorConcept<_BidirectionalIter1>); + glibcpp_function_requires(BidirectionalIteratorConcept<_BidirectionalIter2>); + typedef reverse_iterator<_BidirectionalIter1> _RevIter1; typedef reverse_iterator<_BidirectionalIter2> _RevIter2; @@ -3119,8 +3467,10 @@ __find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1, bidirectional_iterator_tag, bidirectional_iterator_tag, _BinaryPredicate __comp) { - __STL_REQUIRES(_BidirectionalIter1, _BidirectionalIterator); - __STL_REQUIRES(_BidirectionalIter2, _BidirectionalIterator); + // concept requirements + glibcpp_function_requires(BidirectionalIteratorConcept<_BidirectionalIter1>); + glibcpp_function_requires(BidirectionalIteratorConcept<_BidirectionalIter2>); + typedef reverse_iterator<_BidirectionalIter1> _RevIter1; typedef reverse_iterator<_BidirectionalIter2> _RevIter2; @@ -3146,14 +3496,16 @@ inline _ForwardIter1 find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2, _ForwardIter2 __last2) { - __STL_REQUIRES(_ForwardIter1, _ForwardIterator); - __STL_REQUIRES(_ForwardIter2, _ForwardIterator); - __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, - typename iterator_traits<_ForwardIter1>::value_type, - typename iterator_traits<_ForwardIter2>::value_type); + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter1>); + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter2>); + glibcpp_function_requires(EqualOpConcept< + typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type>); + return __find_end(__first1, __last1, __first2, __last2, - __ITERATOR_CATEGORY(__first1), - __ITERATOR_CATEGORY(__first2)); + __iterator_category(__first1), + __iterator_category(__first2)); } template <class _ForwardIter1, class _ForwardIter2, @@ -3163,15 +3515,16 @@ find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPredicate __comp) { - __STL_REQUIRES(_ForwardIter1, _ForwardIterator); - __STL_REQUIRES(_ForwardIter2, _ForwardIterator); - __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, - typename iterator_traits<_ForwardIter1>::value_type, - typename iterator_traits<_ForwardIter2>::value_type); + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter1>); + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter2>); + glibcpp_function_requires(BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type>); return __find_end(__first1, __last1, __first2, __last2, - __ITERATOR_CATEGORY(__first1), - __ITERATOR_CATEGORY(__first2), + __iterator_category(__first1), + __iterator_category(__first2), __comp); } @@ -3209,9 +3562,11 @@ bool __is_heap(_RandomAccessIter __first, _StrictWeakOrdering __comp, template <class _RandomAccessIter> inline bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last) { - __STL_REQUIRES(_RandomAccessIter, _RandomAccessIterator); - __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, - _LessThanComparable); + // concept requirements + glibcpp_function_requires(RandomAccessIteratorConcept<_RandomAccessIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_RandomAccessIter>::value_type>); + return __is_heap(__first, __last - __first); } @@ -3220,10 +3575,12 @@ template <class _RandomAccessIter, class _StrictWeakOrdering> inline bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last, _StrictWeakOrdering __comp) { - __STL_REQUIRES(_RandomAccessIter, _RandomAccessIterator); - __STL_BINARY_FUNCTION_CHECK(_StrictWeakOrdering, bool, - typename iterator_traits<_RandomAccessIter>::value_type, - typename iterator_traits<_RandomAccessIter>::value_type); + // concept requirements + glibcpp_function_requires(RandomAccessIteratorConcept<_RandomAccessIter>); + glibcpp_function_requires(BinaryPredicateConcept<_StrictWeakOrdering, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type>); + return __is_heap(__first, __comp, __last - __first); } @@ -3234,9 +3591,11 @@ inline bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last, template <class _ForwardIter> bool is_sorted(_ForwardIter __first, _ForwardIter __last) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, - _LessThanComparable); + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_ForwardIter>::value_type>); + if (__first == __last) return true; @@ -3253,10 +3612,12 @@ template <class _ForwardIter, class _StrictWeakOrdering> bool is_sorted(_ForwardIter __first, _ForwardIter __last, _StrictWeakOrdering __comp) { - __STL_REQUIRES(_ForwardIter, _ForwardIterator); - __STL_BINARY_FUNCTION_CHECK(_StrictWeakOrdering, bool, - typename iterator_traits<_ForwardIter>::value_type, - typename iterator_traits<_ForwardIter>::value_type); + // concept requirements + glibcpp_function_requires(ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(BinaryPredicateConcept<_StrictWeakOrdering, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type>); + if (__first == __last) return true; diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index c4620c1..df768c6 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -46,10 +46,10 @@ #include <new> #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> - -// We pick up concept_checks.h from stl_iterator_base.h. +#include <bits/concept_check.h> namespace std { @@ -57,26 +57,35 @@ namespace std // swap and iter_swap 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; *__a = *__b; *__b = __tmp; } template <class _ForwardIter1, class _ForwardIter2> -inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b) { - __STL_REQUIRES(_ForwardIter1, _Mutable_ForwardIterator); - __STL_REQUIRES(_ForwardIter2, _Mutable_ForwardIterator); - __STL_CONVERTIBLE(typename iterator_traits<_ForwardIter1>::value_type, - typename iterator_traits<_ForwardIter2>::value_type); - __STL_CONVERTIBLE(typename iterator_traits<_ForwardIter2>::value_type, - typename iterator_traits<_ForwardIter1>::value_type); - __iter_swap(__a, __b, __VALUE_TYPE(__a)); +inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter1>); + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter2>); + glibcpp_function_requires(ConvertibleConcept< + typename iterator_traits<_ForwardIter1>::value_type, + 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> -inline void swap(_Tp& __a, _Tp& __b) { - __STL_REQUIRES(_Tp, _Assignable); +inline void swap(_Tp& __a, _Tp& __b) +{ + // concept requirements + glibcpp_function_requires(SGIAssignableConcept<_Tp>); + _Tp __tmp = __a; __a = __b; __b = __tmp; @@ -90,14 +99,16 @@ inline void swap(_Tp& __a, _Tp& __b) { template <class _Tp> 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; if (__b < __a) return __b; return __a; } template <class _Tp> 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; if (__a < __b) return __b; return __a; } @@ -148,7 +159,8 @@ __copy(_RandomAccessIter __first, _RandomAccessIter __last, template <class _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)); return __result + (__last - __first); } @@ -156,40 +168,41 @@ __copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) { template <class _InputIter, class _OutputIter> inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last, - _OutputIter __result, __false_type) { + _OutputIter __result, __false_type) +{ return __copy(__first, __last, __result, - __ITERATOR_CATEGORY(__first), - __DISTANCE_TYPE(__first)); + __iterator_category(__first), + __distance_type(__first)); } template <class _InputIter, class _OutputIter> inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last, - _OutputIter __result, __true_type) { + _OutputIter __result, __true_type) +{ return __copy(__first, __last, __result, - __ITERATOR_CATEGORY(__first), - __DISTANCE_TYPE(__first)); + __iterator_category(__first), + __distance_type(__first)); } -#ifndef __USLC__ - template <class _Tp> inline _Tp* __copy_aux2(_Tp* __first, _Tp* __last, _Tp* __result, - __true_type) { + __true_type) +{ return __copy_trivial(__first, __last, __result); } -#endif /* __USLC__ */ - template <class _Tp> inline _Tp* __copy_aux2(const _Tp* __first, const _Tp* __last, _Tp* __result, - __true_type) { + __true_type) +{ return __copy_trivial(__first, __last, __result); } template <class _InputIter, class _OutputIter, class _Tp> inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, - _OutputIter __result, _Tp*) { + _OutputIter __result, _Tp*) +{ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _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> inline _OutputIter __copy_ni2(_InputIter __first, _InputIter __last, - _OutputIter __result, __true_type) { + _OutputIter __result, __true_type) +{ return _OutputIter(__copy_aux(__first, __last, __result.base(), - __VALUE_TYPE(__first))); + __value_type(__first))); } template<typename _InputIter, typename _OutputIter> inline _OutputIter __copy_ni2(_InputIter __first, _InputIter __last, - _OutputIter __result, __false_type) { - return __copy_aux(__first, __last, __result, __VALUE_TYPE(__first)); + _OutputIter __result, __false_type) +{ + return __copy_aux(__first, __last, __result, __value_type(__first)); } template<typename _InputIter, typename _OutputIter> inline _OutputIter __copy_ni1(_InputIter __first, _InputIter __last, - _OutputIter __result, __true_type) { + _OutputIter __result, __true_type) +{ typedef typename _Is_normal_iterator<_OutputIter>::_Normal __Normal; return __copy_ni2(__first.base(), __last.base(), __result, __Normal()); } template<typename _InputIter, typename _OutputIter> inline _OutputIter __copy_ni1(_InputIter __first, _InputIter __last, - _OutputIter __result, __false_type) { + _OutputIter __result, __false_type) +{ typedef typename _Is_normal_iterator<_OutputIter>::_Normal __Normal; return __copy_ni2(__first, __last, __result, __Normal()); } template <class _InputIter, class _OutputIter> inline _OutputIter copy(_InputIter __first, _InputIter __last, - _OutputIter __result) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); + _OutputIter __result) +{ + // 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; 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> -inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) { - __STL_REQUIRES(_BI1, _BidirectionalIterator); - __STL_REQUIRES(_BI2, _Mutable_BidirectionalIterator); - __STL_CONVERTIBLE(typename iterator_traits<_BI1>::value_type, - typename iterator_traits<_BI2>::value_type); +inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) +{ + // concept requirements + glibcpp_function_requires(BidirectionalIteratorConcept<_BI1>); + 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; return __copy_backward_input_normal_iterator(__first, __last, __result, __Normal()); @@ -376,14 +401,18 @@ template <class _InputIter, class _Size, class _OutputIter> inline pair<_InputIter, _OutputIter> __copy_n(_InputIter __first, _Size __count, _OutputIter __result) { return __copy_n(__first, __count, __result, - __ITERATOR_CATEGORY(__first)); + __iterator_category(__first)); } template <class _InputIter, class _Size, class _OutputIter> inline pair<_InputIter, _OutputIter> -copy_n(_InputIter __first, _Size __count, _OutputIter __result) { - __STL_REQUIRES(_InputIter, _InputIterator); - __STL_REQUIRES(_OutputIter, _OutputIterator); +copy_n(_InputIter __first, _Size __count, _OutputIter __result) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIter, + typename iterator_traits<_InputIter>::value_type>); + return __copy_n(__first, __count, __result); } @@ -392,15 +421,21 @@ copy_n(_InputIter __first, _Size __count, _OutputIter __result) { template <class _ForwardIter, class _Tp> -void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); +void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) +{ + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + for ( ; __first != __last; ++__first) *__first = __value; } template <class _OutputIter, class _Size, class _Tp> -_OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) { - __STL_REQUIRES(_OutputIter, _OutputIterator); +_OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) +{ + // concept requirements + glibcpp_function_requires(OutputIteratorConcept<_OutputIter,_Tp>); + for ( ; __n > 0; --__n, ++__first) *__first = __value; 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. inline void fill(unsigned char* __first, unsigned char* __last, - const unsigned char& __c) { + const unsigned char& __c) +{ unsigned char __tmp = __c; memset(__first, __tmp, __last - __first); } inline void fill(signed char* __first, signed char* __last, - const signed char& __c) { + const signed char& __c) +{ signed char __tmp = __c; 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; memset(__first, static_cast<unsigned char>(__tmp), __last - __first); } template <class _Size> inline unsigned char* fill_n(unsigned char* __first, _Size __n, - const unsigned char& __c) { + const unsigned char& __c) +{ fill(__first, __first + __n, __c); return __first + __n; } template <class _Size> inline signed char* fill_n(char* __first, _Size __n, - const signed char& __c) { + const signed char& __c) +{ fill(__first, __first + __n, __c); return __first + __n; } 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); return __first + __n; } @@ -452,13 +493,16 @@ inline char* fill_n(char* __first, _Size __n, const char& __c) { template <class _InputIter1, class _InputIter2> pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, - _EqualityComparable); - __STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, - _EqualityComparable); + _InputIter2 __first2) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(EqualityComparableConcept< + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(EqualityComparableConcept< + typename iterator_traits<_InputIter2>::value_type>); + while (__first1 != __last1 && *__first1 == *__first2) { ++__first1; ++__first2; @@ -470,9 +514,12 @@ template <class _InputIter1, class _InputIter2, class _BinaryPredicate> pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, - _BinaryPredicate __binary_pred) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); + _BinaryPredicate __binary_pred) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) { ++__first1; ++__first2; @@ -482,13 +529,16 @@ pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, template <class _InputIter1, class _InputIter2> inline bool equal(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, - _EqualityComparable); - __STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, - _EqualityComparable); + _InputIter2 __first2) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(EqualityComparableConcept< + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(EqualityComparableConcept< + typename iterator_traits<_InputIter2>::value_type>); + for ( ; __first1 != __last1; ++__first1, ++__first2) if (*__first1 != *__first2) return false; @@ -497,9 +547,12 @@ inline bool equal(_InputIter1 __first1, _InputIter1 __last1, template <class _InputIter1, class _InputIter2, class _BinaryPredicate> inline bool equal(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _BinaryPredicate __binary_pred) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); + _InputIter2 __first2, _BinaryPredicate __binary_pred) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + for ( ; __first1 != __last1; ++__first1, ++__first2) if (!__binary_pred(*__first1, *__first2)) return false; @@ -512,13 +565,16 @@ inline bool equal(_InputIter1 __first1, _InputIter1 __last1, template <class _InputIter1, class _InputIter2> bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, - _LessThanComparable); - __STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, - _LessThanComparable); + _InputIter2 __first2, _InputIter2 __last2) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter2>::value_type>); + for ( ; __first1 != __last1 && __first2 != __last2 ; ++__first1, ++__first2) { if (*__first1 < *__first2) @@ -532,9 +588,12 @@ bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, template <class _InputIter1, class _InputIter2, class _Compare> bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, - _Compare __comp) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); + _Compare __comp) +{ + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + for ( ; __first1 != __last1 && __first2 != __last2 ; ++__first1, ++__first2) { if (__comp(*__first1, *__first2)) @@ -628,12 +687,14 @@ template <class _InputIter1, class _InputIter2> int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2) { - __STL_REQUIRES(_InputIter1, _InputIterator); - __STL_REQUIRES(_InputIter2, _InputIterator); - __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, - _LessThanComparable); - __STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, - _LessThanComparable); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIter1>); + glibcpp_function_requires(InputIteratorConcept<_InputIter2>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter1>::value_type>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_InputIter2>::value_type>); + return __lexicographical_compare_3way(__first1, __last1, __first2, __last2); } diff --git a/libstdc++-v3/include/bits/stl_construct.h b/libstdc++-v3/include/bits/stl_construct.h index e423bdd..3a38c34 100644 --- a/libstdc++-v3/include/bits/stl_construct.h +++ b/libstdc++-v3/include/bits/stl_construct.h @@ -81,7 +81,7 @@ __destroy(_ForwardIterator __first, _ForwardIterator __last, _Tp*) template <class _ForwardIterator> inline void _Destroy(_ForwardIterator __first, _ForwardIterator __last) { - __destroy(__first, __last, __VALUE_TYPE(__first)); + __destroy(__first, __last, __value_type(__first)); } inline void _Destroy(char*, char*) {} diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index 040152d..8e7f130 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -28,7 +28,9 @@ * 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 #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> > class deque : protected _Deque_base<_Tp, _Alloc> { - // requirements: - - __STL_CLASS_REQUIRES(_Tp, _Assignable); + // concept requirements + glibcpp_class_requires(_Tp, SGIAssignableConcept); typedef _Deque_base<_Tp, _Alloc> _Base; public: // Basic types @@ -469,7 +470,7 @@ public: // Constructor, destructor. template <class _InputIter> void _M_initialize_dispatch(_InputIter __first, _InputIter __last, __false_type) { - _M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first)); + _M_range_initialize(__first, __last, __iterator_category(__first)); } ~deque() { destroy(_M_start, _M_finish); } @@ -531,7 +532,7 @@ private: // helper functions for assign() template <class _InputIterator> void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { - _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); + _M_assign_aux(__first, __last, __iterator_category(__first)); } template <class _InputIterator> @@ -653,7 +654,7 @@ public: // Insert void _M_insert_dispatch(iterator __pos, _InputIterator __first, _InputIterator __last, __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) { diff --git a/libstdc++-v3/include/bits/stl_heap.h b/libstdc++-v3/include/bits/stl_heap.h index a6003c8..3fdd236 100644 --- a/libstdc++-v3/include/bits/stl_heap.h +++ b/libstdc++-v3/include/bits/stl_heap.h @@ -62,11 +62,14 @@ template <class _RandomAccessIterator> inline void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { - __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); - __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, - _LessThanComparable); + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>); + __push_heap_aux(__first, __last, - __DISTANCE_TYPE(__first), __VALUE_TYPE(__first)); + __distance_type(__first), __value_type(__first)); } template <class _RandomAccessIterator, class _Distance, class _Tp, @@ -100,9 +103,12 @@ inline void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { - __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>); + __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> @@ -141,17 +147,20 @@ __pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last, _Tp*) { __pop_heap(__first, __last - 1, __last - 1, - _Tp(*(__last - 1)), __DISTANCE_TYPE(__first)); + _Tp(*(__last - 1)), __distance_type(__first)); } template <class _RandomAccessIterator> inline void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { - __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); - __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, - _LessThanComparable); - __pop_heap_aux(__first, __last, __VALUE_TYPE(__first)); + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>); + + __pop_heap_aux(__first, __last, __value_type(__first)); } template <class _RandomAccessIterator, class _Distance, @@ -194,7 +203,7 @@ __pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last, _Tp*, _Compare __comp) { __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp, - __DISTANCE_TYPE(__first)); + __distance_type(__first)); } template <class _RandomAccessIterator, class _Compare> @@ -202,8 +211,11 @@ inline void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { - __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); - __pop_heap_aux(__first, __last, __VALUE_TYPE(__first), __comp); + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>); + + __pop_heap_aux(__first, __last, __value_type(__first), __comp); } template <class _RandomAccessIterator, class _Tp, class _Distance> @@ -226,11 +238,14 @@ template <class _RandomAccessIterator> inline void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { - __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); - __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, - _LessThanComparable); + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>); + __make_heap(__first, __last, - __VALUE_TYPE(__first), __DISTANCE_TYPE(__first)); + __value_type(__first), __distance_type(__first)); } template <class _RandomAccessIterator, class _Compare, @@ -256,17 +271,23 @@ inline void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { - __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>); + __make_heap(__first, __last, __comp, - __VALUE_TYPE(__first), __DISTANCE_TYPE(__first)); + __value_type(__first), __distance_type(__first)); } template <class _RandomAccessIterator> void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { - __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); - __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, - _LessThanComparable); + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>); + glibcpp_function_requires(LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>); + while (__last - __first > 1) pop_heap(__first, __last--); } @@ -276,7 +297,10 @@ void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { - __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + // concept requirements + glibcpp_function_requires(Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>); + while (__last - __first > 1) pop_heap(__first, __last--, __comp); } diff --git a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h new file mode 100644 index 0000000..138a69b --- /dev/null +++ b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h @@ -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: diff --git a/libstdc++-v3/include/bits/stl_iterator_base.h b/libstdc++-v3/include/bits/stl_iterator_base_types.h index 5c5ac2c..6b821f6 100644 --- a/libstdc++-v3/include/bits/stl_iterator_base.h +++ b/libstdc++-v3/include/bits/stl_iterator_base_types.h @@ -28,14 +28,15 @@ * You should not attempt to use it directly. */ -#ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_H -#define __SGI_STL_INTERNAL_ITERATOR_BASE_H +#ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_TYPES_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, // such as front_insert_iterator and istream_iterator. -#include <bits/concept_checks.h> +#pragma GCC system header namespace std { @@ -171,93 +172,9 @@ template <class _Iter> inline typename iterator_traits<_Iter>::value_type* 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 -#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_H */ +#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_TYPES_H */ // Local Variables: diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index b018317..fb00c47 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -31,7 +31,7 @@ #ifndef __SGI_STL_INTERNAL_LIST_H #define __SGI_STL_INTERNAL_LIST_H -#include <bits/concept_checks.h> +#include <bits/concept_check.h> namespace std { @@ -198,10 +198,10 @@ _List_base<_Tp,_Alloc>::clear() } template <class _Tp, class _Alloc = allocator<_Tp> > -class list : protected _List_base<_Tp, _Alloc> { - // requirements: - - __STL_CLASS_REQUIRES(_Tp, _Assignable); +class list : protected _List_base<_Tp, _Alloc> +{ + // concept requirements + glibcpp_class_requires(_Tp, SGIAssignableConcept); typedef _List_base<_Tp, _Alloc> _Base; protected: diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index a725004..7a6ef7a 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -31,23 +31,21 @@ #ifndef _CPP_BITS_STL_MAP_H #define _CPP_BITS_STL_MAP_H 1 -#include <bits/concept_checks.h> +#include <bits/concept_check.h> namespace std { template <class _Key, class _Tp, class _Compare = less<_Key>, class _Alloc = allocator<pair<const _Key, _Tp> > > -class map { -public: - -// requirements: - - __STL_CLASS_REQUIRES(_Tp, _Assignable); - __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); - -// typedefs: +class map +{ + // concept requirements + glibcpp_class_requires(_Tp, SGIAssignableConcept); + glibcpp_class_requires4(_Compare, bool, _Key, _Key, BinaryFunctionConcept); +public: + // typedefs: typedef _Key key_type; typedef _Tp data_type; typedef _Tp mapped_type; diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index 35d2263..558075e 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -31,7 +31,7 @@ #ifndef __SGI_STL_INTERNAL_MULTIMAP_H #define __SGI_STL_INTERNAL_MULTIMAP_H -#include <bits/concept_checks.h> +#include <bits/concept_check.h> namespace std { @@ -52,11 +52,11 @@ inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, const multimap<_Key,_Tp,_Compare,_Alloc>& __y); template <class _Key, class _Tp, class _Compare, class _Alloc> -class multimap { - // requirements: - - __STL_CLASS_REQUIRES(_Tp, _Assignable); - __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); +class multimap +{ + // concept requirements + glibcpp_class_requires(_Tp, SGIAssignableConcept); + glibcpp_class_requires4(_Compare, bool, _Key, _Key, BinaryFunctionConcept); public: diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index 8b2c63f..e723cc2 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -31,7 +31,7 @@ #ifndef __SGI_STL_INTERNAL_MULTISET_H #define __SGI_STL_INTERNAL_MULTISET_H -#include <bits/concept_checks.h> +#include <bits/concept_check.h> namespace std { @@ -51,11 +51,11 @@ inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x, const multiset<_Key,_Compare,_Alloc>& __y); template <class _Key, class _Compare, class _Alloc> -class multiset { - // requirements: - - __STL_CLASS_REQUIRES(_Key, _Assignable); - __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); +class multiset +{ + // concept requirements + glibcpp_class_requires(_Key, SGIAssignableConcept); + glibcpp_class_requires4(_Compare, bool, _Key, _Key, BinaryFunctionConcept); public: diff --git a/libstdc++-v3/include/bits/stl_numeric.h b/libstdc++-v3/include/bits/stl_numeric.h index 0a084e5..8656e99 100644 --- a/libstdc++-v3/include/bits/stl_numeric.h +++ b/libstdc++-v3/include/bits/stl_numeric.h @@ -38,7 +38,9 @@ namespace std template <class _InputIterator, class _Tp> _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) { - __STL_REQUIRES(_InputIterator, _InputIterator); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIterator>); + for ( ; __first != __last; ++__first) __init = __init + *__first; return __init; @@ -48,7 +50,9 @@ template <class _InputIterator, class _Tp, class _BinaryOperation> _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { - __STL_REQUIRES(_InputIterator, _InputIterator); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIterator>); + for ( ; __first != __last; ++__first) __init = __binary_op(__init, *__first); return __init; @@ -58,8 +62,10 @@ template <class _InputIterator1, class _InputIterator2, class _Tp> _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { - __STL_REQUIRES(_InputIterator2, _InputIterator); - __STL_REQUIRES(_InputIterator2, _InputIterator); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIterator1>); + glibcpp_function_requires(InputIteratorConcept<_InputIterator2>); + for ( ; __first1 != __last1; ++__first1, ++__first2) __init = __init + (*__first1 * *__first2); return __init; @@ -72,8 +78,10 @@ _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { - __STL_REQUIRES(_InputIterator2, _InputIterator); - __STL_REQUIRES(_InputIterator2, _InputIterator); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIterator1>); + glibcpp_function_requires(InputIteratorConcept<_InputIterator2>); + for ( ; __first1 != __last1; ++__first1, ++__first2) __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); return __init; @@ -97,11 +105,14 @@ _OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { - __STL_REQUIRES(_InputIterator, _InputIterator); - __STL_REQUIRES(_OutputIterator, _OutputIterator); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIterator>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>); + if (__first == __last) return __result; *__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, @@ -123,11 +134,14 @@ _OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) { - __STL_REQUIRES(_InputIterator, _InputIterator); - __STL_REQUIRES(_OutputIterator, _OutputIterator); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIterator>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>); + if (__first == __last) return __result; *__result = *__first; - return __partial_sum(__first, __last, __result, __VALUE_TYPE(__first), + return __partial_sum(__first, __last, __result, __value_type(__first), __binary_op); } @@ -150,12 +164,15 @@ _OutputIterator adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { - __STL_REQUIRES(_InputIterator, _InputIterator); - __STL_REQUIRES(_OutputIterator, _OutputIterator); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIterator>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>); + if (__first == __last) return __result; *__result = *__first; return __adjacent_difference(__first, __last, __result, - __VALUE_TYPE(__first)); + __value_type(__first)); } template <class _InputIterator, class _OutputIterator, class _Tp, @@ -178,12 +195,15 @@ _OutputIterator adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) { - __STL_REQUIRES(_InputIterator, _InputIterator); - __STL_REQUIRES(_OutputIterator, _OutputIterator); + // concept requirements + glibcpp_function_requires(InputIteratorConcept<_InputIterator>); + glibcpp_function_requires(OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>); + if (__first == __last) return __result; *__result = *__first; return __adjacent_difference(__first, __last, __result, - __VALUE_TYPE(__first), + __value_type(__first), __binary_op); } @@ -241,8 +261,11 @@ template <class _ForwardIter, class _Tp> void iota(_ForwardIter __first, _ForwardIter __last, _Tp __value) { - __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); - __STL_CONVERTIBLE(_Tp, typename iterator_traits<_ForwardIter>::value_type); + // concept requirements + glibcpp_function_requires(Mutable_ForwardIteratorConcept<_ForwardIter>); + glibcpp_function_requires(ConvertibleConcept<_Tp, + typename iterator_traits<_ForwardIter>::value_type>); + while (__first != __last) *__first++ = __value++; } diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h index d6ca812..f52838b 100644 --- a/libstdc++-v3/include/bits/stl_queue.h +++ b/libstdc++-v3/include/bits/stl_queue.h @@ -31,7 +31,7 @@ #ifndef __SGI_STL_INTERNAL_QUEUE_H #define __SGI_STL_INTERNAL_QUEUE_H -#include <bits/sequence_concepts.h> +#include <bits/concept_check.h> namespace std { @@ -50,16 +50,14 @@ inline bool operator<(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&); template <class _Tp, class _Sequence> -class queue { - - // requirements: - - __STL_CLASS_REQUIRES(_Tp, _Assignable); - __STL_CLASS_REQUIRES(_Sequence, _FrontInsertionSequence); - __STL_CLASS_REQUIRES(_Sequence, _BackInsertionSequence); +class queue +{ + // concept requirements + glibcpp_class_requires(_Tp, SGIAssignableConcept); + glibcpp_class_requires(_Sequence, FrontInsertionSequenceConcept); + glibcpp_class_requires(_Sequence, BackInsertionSequenceConcept); 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> 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, class _Sequence = vector<_Tp>, class _Compare = less<typename _Sequence::value_type> > -class priority_queue { -public: - - // requirements: - __STL_CLASS_REQUIRES(_Tp, _Assignable); - __STL_CLASS_REQUIRES(_Sequence, _Sequence); - __STL_CLASS_REQUIRES(_Sequence, _RandomAccessContainer); +class priority_queue +{ + // concept requirements + glibcpp_class_requires(_Tp, SGIAssignableConcept); + glibcpp_class_requires(_Sequence, SequenceConcept); + glibcpp_class_requires(_Sequence, RandomAccessContainerConcept); typedef typename _Sequence::value_type _Sequence_value_type; - __STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type); - __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + glibcpp_class_requires2(_Tp, _Sequence_value_type, SameTypeConcept); + glibcpp_class_requires4(_Compare, bool, _Tp, _Tp, BinaryFunctionConcept); +public: typedef typename _Sequence::value_type value_type; typedef typename _Sequence::size_type size_type; typedef _Sequence container_type; diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index 03bb190..32c7a0a 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -31,7 +31,7 @@ #ifndef __SGI_STL_INTERNAL_SET_H #define __SGI_STL_INTERNAL_SET_H -#include <bits/concept_checks.h> +#include <bits/concept_check.h> namespace std { @@ -52,15 +52,14 @@ inline bool operator<(const set<_Key,_Compare,_Alloc>& __x, template <class _Key, class _Compare, class _Alloc> -class set { - // requirements: - - __STL_CLASS_REQUIRES(_Key, _Assignable); - __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); +class set +{ + // concept requirements + glibcpp_class_requires(_Key, SGIAssignableConcept); + glibcpp_class_requires4(_Compare, bool, _Key, _Key, BinaryFunctionConcept); public: // typedefs: - typedef _Key key_type; typedef _Key value_type; typedef _Compare key_compare; diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h index 72e67bd..3774d4c3 100644 --- a/libstdc++-v3/include/bits/stl_stack.h +++ b/libstdc++-v3/include/bits/stl_stack.h @@ -31,7 +31,7 @@ #ifndef __SGI_STL_INTERNAL_STACK_H #define __SGI_STL_INTERNAL_STACK_H -#include <bits/sequence_concepts.h> +#include <bits/concept_check.h> namespace std { @@ -50,15 +50,13 @@ bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y); template <class _Tp, class _Sequence> -class stack { - - // requirements: - - __STL_CLASS_REQUIRES(_Tp, _Assignable); - __STL_CLASS_REQUIRES(_Sequence, _BackInsertionSequence); +class stack +{ + // concept requirements + glibcpp_class_requires(_Tp, SGIAssignableConcept); + glibcpp_class_requires(_Sequence, BackInsertionSequenceConcept); 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> friend bool operator== (const stack<_Tp1, _Seq1>&, diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h index acbf4ab..6f7c5a4 100644 --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -80,7 +80,7 @@ inline _ForwardIter _ForwardIter __result) { return __uninitialized_copy(__first, __last, __result, - __VALUE_TYPE(__result)); + __value_type(__result)); } 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, _ForwardIter __result) { return __uninitialized_copy_n(__first, __count, __result, - __ITERATOR_CATEGORY(__first)); + __iterator_category(__first)); } template <class _InputIter, class _Size, class _ForwardIter> @@ -138,7 +138,7 @@ inline pair<_InputIter, _ForwardIter> uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __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 @@ -178,7 +178,7 @@ inline void uninitialized_fill(_ForwardIter __first, _ForwardIter __last, 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 @@ -217,7 +217,7 @@ template <class _ForwardIter, class _Size, class _Tp> inline _ForwardIter 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, diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index afdb1e3..a764db3 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -31,8 +31,9 @@ #ifndef __SGI_STL_INTERNAL_VECTOR_H #define __SGI_STL_INTERNAL_VECTOR_H +#include <bits/stl_iterator_base_funcs.h> #include <bits/functexcept.h> -#include <bits/concept_checks.h> +#include <bits/concept_check.h> namespace std { @@ -116,9 +117,8 @@ struct _Vector_base template <class _Tp, class _Alloc = allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> { - // requirements: - - __STL_CLASS_REQUIRES(_Tp, _Assignable); + // concept requirements + glibcpp_class_requires(_Tp, SGIAssignableConcept); private: typedef _Vector_base<_Tp, _Alloc> _Base; @@ -223,7 +223,7 @@ public: template <class _InputIterator> void _M_initialize_aux(_InputIterator __first, _InputIterator __last, __false_type) { - _M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first)); + _M_range_initialize(__first, __last, __iterator_category(__first)); } ~vector() { destroy(_M_start, _M_finish); } @@ -261,7 +261,7 @@ public: template <class _InputIter> 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> void _M_assign_aux(_InputIterator __first, _InputIterator __last, @@ -334,7 +334,7 @@ public: void _M_insert_dispatch(iterator __pos, _InputIterator __first, _InputIterator __last, __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) diff --git a/libstdc++-v3/include/ext/hash_map b/libstdc++-v3/include/ext/hash_map index cbaf1d6..ddb32c7 100644 --- a/libstdc++-v3/include/ext/hash_map +++ b/libstdc++-v3/include/ext/hash_map @@ -32,6 +32,7 @@ #define __SGI_STL_INTERNAL_HASH_MAP_H #include <ext/stl_hashtable.h> +#include <bits/concept_check.h> namespace std { @@ -121,8 +122,6 @@ public: friend bool operator== (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 end() { return _M_ht.end(); } 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> class hash_multimap { - // requirements: - __STL_CLASS_REQUIRES(_Key, _Assignable); - __STL_CLASS_REQUIRES(_Tp, _Assignable); - __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Key); - __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Key, _Key); + // concept requirements + glibcpp_class_requires(_Key, SGIAssignableConcept); + glibcpp_class_requires(_Tp, SGIAssignableConcept); + glibcpp_class_requires3(_HashFcn, size_t, _Key, UnaryFunctionConcept); + glibcpp_class_requires3(_EqualKey, _Key, _Key, BinaryPredicateConcept); private: typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFcn, diff --git a/libstdc++-v3/include/ext/hash_set b/libstdc++-v3/include/ext/hash_set index aedf1b5..e99a884 100644 --- a/libstdc++-v3/include/ext/hash_set +++ b/libstdc++-v3/include/ext/hash_set @@ -32,8 +32,7 @@ #define __SGI_STL_INTERNAL_HASH_SET_H #include <ext/stl_hashtable.h> - -#include <bits/concept_checks.h> +#include <bits/concept_check.h> namespace std { @@ -54,11 +53,10 @@ operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1, template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> class hash_set { - // requirements: - - __STL_CLASS_REQUIRES(_Value, _Assignable); - __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Value); - __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Value, _Value); + // concept requirements + glibcpp_class_requires(_Value, SGIAssignableConcept); + glibcpp_class_requires3(_HashFcn, size_t, _Value, UnaryFunctionConcept); + glibcpp_class_requires3(_EqualKey, _Value, _Value, BinaryPredicateConcept); private: 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> class hash_multiset { - // requirements: - - __STL_CLASS_REQUIRES(_Value, _Assignable); - __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Value); - __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Value, _Value); + // concept requirements + glibcpp_class_requires(_Value, SGIAssignableConcept); + glibcpp_class_requires3(_HashFcn, size_t, _Value, UnaryFunctionConcept); + glibcpp_class_requires3(_EqualKey, _Value, _Value, BinaryPredicateConcept); private: typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, diff --git a/libstdc++-v3/include/ext/slist b/libstdc++-v3/include/ext/slist index 3c70c5c..68cbccc 100644 --- a/libstdc++-v3/include/ext/slist +++ b/libstdc++-v3/include/ext/slist @@ -19,7 +19,7 @@ #ifndef __SGI_STL_INTERNAL_SLIST_H #define __SGI_STL_INTERNAL_SLIST_H -#include <bits/concept_checks.h> +#include <bits/concept_check.h> 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> > class slist : private _Slist_base<_Tp,_Alloc> { - // requirements: - - __STL_CLASS_REQUIRES(_Tp, _Assignable); + // concept requirements + glibcpp_class_requires(_Tp, SGIAssignableConcept); private: typedef _Slist_base<_Tp,_Alloc> _Base; diff --git a/libstdc++-v3/include/ext/stl_hashtable.h b/libstdc++-v3/include/ext/stl_hashtable.h index 1276b95..aa87ba5 100644 --- a/libstdc++-v3/include/ext/stl_hashtable.h +++ b/libstdc++-v3/include/ext/stl_hashtable.h @@ -353,13 +353,13 @@ public: template <class _InputIterator> void insert_unique(_InputIterator __f, _InputIterator __l) { - insert_unique(__f, __l, __ITERATOR_CATEGORY(__f)); + insert_unique(__f, __l, __iterator_category(__f)); } template <class _InputIterator> void insert_equal(_InputIterator __f, _InputIterator __l) { - insert_equal(__f, __l, __ITERATOR_CATEGORY(__f)); + insert_equal(__f, __l, __iterator_category(__f)); } template <class _InputIterator> diff --git a/libstdc++-v3/libio/Makefile.in b/libstdc++-v3/libio/Makefile.in index 07b4205..897ea7a 100644 --- a/libstdc++-v3/libio/Makefile.in +++ b/libstdc++-v3/libio/Makefile.in @@ -111,7 +111,7 @@ xcompiling = @xcompiling@ AUTOMAKE_OPTIONS = 1.3 cygnus 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 = # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES @@ -123,14 +123,21 @@ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@ LIBIO_INCLUDES = @LIBIO_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_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 = EXTRA_DIST = iostreamP.h diff --git a/libstdc++-v3/libmath/Makefile.in b/libstdc++-v3/libmath/Makefile.in index 4aa5b2a..76191e9 100644 --- a/libstdc++-v3/libmath/Makefile.in +++ b/libstdc++-v3/libmath/Makefile.in @@ -114,18 +114,24 @@ mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs 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_SOURCES = signbit.c signbitf.c +libmath_la_SOURCES = \ + signbit.c signbitf.c LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @@ -139,7 +145,9 @@ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@ LIBIO_INCLUDES = @LIBIO_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_CLEAN_FILES = diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index edeec53..226902c 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -129,11 +129,13 @@ OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@ # 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 # 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. -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 @@ -145,13 +147,38 @@ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@ LIBIO_INCLUDES = @LIBIO_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) - - -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 +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 + + +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) @@ -167,7 +194,12 @@ LIBSUPCXX_CXXFLAGS = -prefer-pic # set this option because CONFIG_CXXFLAGS has to be after # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden # 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 @@ -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 # 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 @@ -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 # directory to configure libstdc++-v3 to use gcc as the C++ # 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_CLEAN_FILES = diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 59ff542..d9dac6c 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -21,7 +21,7 @@ ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ## 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 MAINT_CHARSET = latin1 @@ -80,7 +80,8 @@ base_headers = \ 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/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 \ @@ -91,12 +92,11 @@ base_headers = \ 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_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 + bits/stl_construct.h bits/boost_concept_check.h bits/concept_check.h + backward_headers = \ 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 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden # 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 = \ - -fno-implicit-templates \ + -fno-implicit-templates -D_GLIBCPP_NO_CONCEPT_CHECKS \ $(LIBSUPCXX_CXXFLAGS) \ $(WARN_CXXFLAGS) \ $(OPTIMIZE_CXXFLAGS) \ diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index 4dc4de8..04779bf 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -121,11 +121,13 @@ OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@ # 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 # 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. -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 @@ -137,44 +139,132 @@ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@ LIBIO_INCLUDES = @LIBIO_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) - - -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 - - -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 - - -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 +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_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 + + +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 + +@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 = -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 +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 = @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 = -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) 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_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 = # 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 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden # 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 @@ -214,7 +313,8 @@ AM_CXXFLAGS = -fno-implicit-templates $(LIBSUPCXX_CXXFLAGS) $(WARN_CXXFLAGS) # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to # 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 @@ -223,7 +323,8 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) $( # course is problematic at this point. So, we get the top-level # directory to configure libstdc++-v3 to use gcc as the C++ # 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_CLEAN_FILES = diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in index 05570ce..0bd44d6 100644 --- a/libstdc++-v3/testsuite/Makefile.in +++ b/libstdc++-v3/testsuite/Makefile.in @@ -118,10 +118,14 @@ AUTOMAKE_OPTIONS = foreign dejagnu no-installinfo 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 CONFIG_HEADER = ../config.h |