summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits
diff options
context:
space:
mode:
authorpme <pme@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-03 00:26:58 +0000
committerpme <pme@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-03 00:26:58 +0000
commit40b5528551e0b9a421b6c8b6342a22e703711b1c (patch)
treebafb595dea147deb7ac77eeb4fcdb31ddddbc477 /libstdc++-v3/include/bits
parent84c7ea2e97ac3aa56f4a8ade20ceddc69f5bddba (diff)
downloadgcc-40b5528551e0b9a421b6c8b6342a22e703711b1c.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41031 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r--libstdc++-v3/include/bits/boost_concept_check.h887
-rw-r--r--libstdc++-v3/include/bits/c++config13
-rw-r--r--libstdc++-v3/include/bits/concept_check.h93
-rw-r--r--libstdc++-v3/include/bits/concept_checks.h811
-rw-r--r--libstdc++-v3/include/bits/container_concepts.h244
-rw-r--r--libstdc++-v3/include/bits/sbuf_iter.h2
-rw-r--r--libstdc++-v3/include/bits/sequence_concepts.h206
-rw-r--r--libstdc++-v3/include/bits/std_iterator.h3
-rw-r--r--libstdc++-v3/include/bits/std_memory.h2
-rw-r--r--libstdc++-v3/include/bits/stl_algo.h1473
-rw-r--r--libstdc++-v3/include/bits/stl_algobase.h249
-rw-r--r--libstdc++-v3/include/bits/stl_construct.h2
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h15
-rw-r--r--libstdc++-v3/include/bits/stl_heap.h72
-rw-r--r--libstdc++-v3/include/bits/stl_iterator_base_funcs.h152
-rw-r--r--libstdc++-v3/include/bits/stl_iterator_base_types.h (renamed from libstdc++-v3/include/bits/stl_iterator_base.h)95
-rw-r--r--libstdc++-v3/include/bits/stl_list.h10
-rw-r--r--libstdc++-v3/include/bits/stl_map.h18
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h12
-rw-r--r--libstdc++-v3/include/bits/stl_multiset.h12
-rw-r--r--libstdc++-v3/include/bits/stl_numeric.h63
-rw-r--r--libstdc++-v3/include/bits/stl_queue.h36
-rw-r--r--libstdc++-v3/include/bits/stl_set.h13
-rw-r--r--libstdc++-v3/include/bits/stl_stack.h16
-rw-r--r--libstdc++-v3/include/bits/stl_uninitialized.h10
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h14
26 files changed, 2385 insertions, 2138 deletions
diff --git a/libstdc++-v3/include/bits/boost_concept_check.h b/libstdc++-v3/include/bits/boost_concept_check.h
new file mode 100644
index 00000000000..1142e049618
--- /dev/null
+++ b/libstdc++-v3/include/bits/boost_concept_check.h
@@ -0,0 +1,887 @@
+//
+// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
+// sell and distribute this software is granted provided this
+// copyright notice appears in all copies. This software is provided
+// "as is" without express or implied warranty, and with no claim as
+// to its suitability for any purpose.
+//
+
+// GCC Note: based on version 1.12.0 of the Boost library.
+#ifndef BOOST_CONCEPT_CHECKS_HPP
+#define BOOST_CONCEPT_CHECKS_HPP
+
+#pragma GCC system_header
+#include <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 2a007f93639..84a9ebcf571 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -63,9 +63,8 @@
# define __STL_UITHREADS
#endif
-// Concept-checking code is off by default unless users define
-// the _STL_USE_CONCEPT_CHECKS hook.
-//#define _STL_USE_CONCEPT_CHECKS 1
+// Concept-checking hooks and related config are now in bits/concept_check.h.
+
// This is also a user hook, but via -f[no-]exceptions, not direct #defines.
#ifdef __EXCEPTIONS
@@ -85,7 +84,8 @@
# define __STL_UNWIND(action)
#endif
-// This is the "underlying allocator"
+// This is the "underlying allocator" for STL. The alternatives are
+// homegrown schemes involving a kind of mutex and free list; see stl_alloc.h.
#define __USE_MALLOC
// Define this to permit user-level control of the expansion of string
@@ -105,11 +105,6 @@
//# define __STL_LONG_LONG
//#endif
-// 20010302 pme -- this is only used in bits/concept_checks.h
-//#if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
-# define __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
-//#endif
-
// Mingw32, GCC compiler using the Microsoft C runtime (settings taken from
// SGI's stl_config.h)
#if defined(__MINGW32__)
diff --git a/libstdc++-v3/include/bits/concept_check.h b/libstdc++-v3/include/bits/concept_check.h
new file mode 100644
index 00000000000..28886a9eb0a
--- /dev/null
+++ b/libstdc++-v3/include/bits/concept_check.h
@@ -0,0 +1,93 @@
+// Concept-checking control -*- C++ -*-
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _GLIBCPP_CONCEPT_CHECK
+#define _GLIBCPP_CONCEPT_CHECK 1
+
+#pragma GCC system_header
+#include <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 aa77d9af063..00000000000
--- a/libstdc++-v3/include/bits/concept_checks.h
+++ /dev/null
@@ -1,811 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __CONCEPT_CHECKS_H
-#define __CONCEPT_CHECKS_H
-
-/*
- Use these macro like assertions, but they assert properties
- on types (usually template arguments). In technical terms they
- verify whether a type "models" a "concept".
-
- This set of requirements and the terminology used here is derived
- from the book "Generic Programming and the STL" by Matt Austern
- (Addison Wesley). For further information please consult that
- book. The requirements also are intended to match the ANSI/ISO C++
- standard.
-
- This file covers the basic concepts and the iterator concepts.
- There are several other files that provide the requirements
- for the STL containers:
- container_concepts.h
- sequence_concepts.h
- assoc_container_concepts.h
-
- Jeremy Siek, 1999
-
- TO DO:
- - some issues with regards to concept classification and mutability
- including AssociativeContianer -> ForwardContainer
- and SortedAssociativeContainer -> ReversibleContainer
- - HashedAssociativeContainer
- - Allocator
- - Function Object Concepts
-
- */
-
-#ifndef __STL_USE_CONCEPT_CHECKS
-
-// Some compilers lack the features that are necessary for concept checks.
-// On those compilers we define the concept check macros to do nothing.
-#define __STL_REQUIRES(__type_var, __concept) do {} while(0)
-#define __STL_CLASS_REQUIRES(__type_var, __concept) \
- static int __##__type_var##_##__concept
-#define __STL_CONVERTIBLE(__type_x, __type_y) do {} while(0)
-#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0)
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
- static int __##__type_x##__type_y##_require_same_type
-#define __STL_GENERATOR_CHECK(__func, __ret) do {} while(0)
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
- static int __##__func##__ret##_generator_check
-#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0)
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
- static int __##__func##__ret##__arg##_unary_function_check
-#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- do {} while(0)
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- static int __##__func##__ret##__first##__second##_binary_function_check
-#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- do {} while(0)
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- static int __##__opname##__ret##__first##__second##_require_binary_op
-
-#else /* __STL_USE_CONCEPT_CHECKS */
-
-// This macro tests whether the template argument "__type_var"
-// satisfies the requirements of "__concept". Here is a list of concepts
-// that we know how to check:
-// _Allocator
-// _Assignable
-// _DefaultConstructible
-// _EqualityComparable
-// _LessThanComparable
-// _TrivialIterator
-// _InputIterator
-// _OutputIterator
-// _ForwardIterator
-// _BidirectionalIterator
-// _RandomAccessIterator
-// _Mutable_TrivialIterator
-// _Mutable_ForwardIterator
-// _Mutable_BidirectionalIterator
-// _Mutable_RandomAccessIterator
-
-#define __STL_REQUIRES(__type_var, __concept) \
-do { \
- void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\
- ::__concept##_requirement_violation; __x = __x; } while (0)
-
-// Use this to check whether type X is convertible to type Y
-#define __STL_CONVERTIBLE(__type_x, __type_y) \
-do { \
- void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \
- __type_y >::__type_X_is_not_convertible_to_type_Y; \
- __x = __x; } while (0)
-
-// Use this to test whether two template arguments are the same type
-#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) \
-do { \
- void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \
- __type_y >::__type_X_not_same_as_type_Y; \
- __x = __x; } while (0)
-
-
-// function object checks
-#define __STL_GENERATOR_CHECK(__func, __ret) \
-do { \
- __ret (*__x)( __func&) = \
- _STL_GENERATOR_ERROR< \
- __func, __ret>::__generator_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
-do { \
- __ret (*__x)( __func&, const __arg& ) = \
- _STL_UNARY_FUNCTION_ERROR< \
- __func, __ret, __arg>::__unary_function_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
-do { \
- __ret (*__x)( __func&, const __first&, const __second& ) = \
- _STL_BINARY_FUNCTION_ERROR< \
- __func, __ret, __first, __second>::__binary_function_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- do { \
- __ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \
- __ret, __first, __second>::__binary_operator_requirement_violation; \
- __ret (*__y)( const __first&, const __second& ) = \
- _STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \
- __const_binary_operator_requirement_violation; \
- __y = __y; __x = __x; } while (0)
-
-
-#ifdef __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
-
-#define __STL_CLASS_REQUIRES(__type_var, __concept)
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y)
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret)
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg)
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second)
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second)
-
-#else
-
-// Use this macro inside of template classes, where you would
-// like to place requirements on the template arguments to the class
-// Warning: do not pass pointers and such (e.g. T*) in as the __type_var,
-// since the type_var is used to construct identifiers. Instead typedef
-// the pointer type, then use the typedef name for the __type_var.
-#define __STL_CLASS_REQUIRES(__type_var, __concept) \
- typedef void (* __func##__type_var##__concept)( __type_var ); \
- template <__func##__type_var##__concept _Tp1> \
- struct __dummy_struct_##__type_var##__concept { }; \
- static __dummy_struct_##__type_var##__concept< \
- __concept##_concept_specification< \
- __type_var>::__concept##_requirement_violation> \
- __dummy_ptr_##__type_var##__concept
-
-
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
- typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \
- __type_y ); \
- template < __func_##__type_x##__type_y##same_type _Tp1> \
- struct __dummy_struct_##__type_x##__type_y##_same_type { }; \
- static __dummy_struct_##__type_x##__type_y##_same_type< \
- _STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y> \
- __dummy_ptr_##__type_x##__type_y##_same_type
-
-
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
- typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \
- template <__f_##__func##__ret##_generator _Tp1> \
- struct __dummy_struct_##__func##__ret##_generator { }; \
- static __dummy_struct_##__func##__ret##_generator< \
- _STL_GENERATOR_ERROR< \
- __func, __ret>::__generator_requirement_violation> \
- __dummy_ptr_##__func##__ret##_generator
-
-
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
- typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \
- const __arg& ); \
- template <__f_##__func##__ret##__arg##_unary_check _Tp1> \
- struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \
- static __dummy_struct_##__func##__ret##__arg##_unary_check< \
- _STL_UNARY_FUNCTION_ERROR< \
- __func, __ret, __arg>::__unary_function_requirement_violation> \
- __dummy_ptr_##__func##__ret##__arg##_unary_check
-
-
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\
- const __second& ); \
- template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \
- struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \
- static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \
- _STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \
- __binary_function_requirement_violation> \
- __dummy_ptr_##__func##__ret##__first##__second##_binary_check
-
-
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \
- const __second& ); \
- template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \
- struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \
- static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \
- _STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \
- __binary_operator_requirement_violation> \
- __dummy_ptr_##__func##__ret##__first##__second##_binary_op
-
-#endif
-
-/* helper class for finding non-const version of a type. Need to have
- something to assign to etc. when testing constant iterators. */
-
-template <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 99aec1c4b62..00000000000
--- a/libstdc++-v3/include/bits/container_concepts.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __STL_CONTAINER_CONCEPTS_H
-#define __STL_CONTAINER_CONCEPTS_H
-
-
-#include <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 2b2a1915eee..052b0dfbe85 100644
--- a/libstdc++-v3/include/bits/sbuf_iter.h
+++ b/libstdc++-v3/include/bits/sbuf_iter.h
@@ -39,7 +39,7 @@ namespace std
template<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 f251e2e26eb..00000000000
--- 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 f4577157279..cb97ed1d21e 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 0f58c08b436..4385a96e2bd 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 090f0d6720e..929c4ff372f 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 c4620c1c6a3..df768c615ff 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 e423bdd3a77..3a38c343d4f 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 040152d9da1..8e7f1305bfd 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 a6003c8f43f..3fdd236b1c9 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 00000000000..138a69be550
--- /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 5c5ac2c0f82..6b821f68322 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 b018317b87b..fb00c474423 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 a725004618f..7a6ef7a32a9 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 35d22634d27..558075ecbeb 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 8b2c63ff03b..e723cc22d41 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 0a084e54747..8656e9955a9 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 d6ca8129465..f52838ba565 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 03bb1906921..32c7a0a54e2 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 72e67bde4da..3774d4c3d12 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 acbf4ab80b8..6f7c5a49297 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 afdb1e3b59a..a764db3de38 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)