diff options
author | pme <pme@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-04-03 00:26:58 +0000 |
---|---|---|
committer | pme <pme@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-04-03 00:26:58 +0000 |
commit | 40b5528551e0b9a421b6c8b6342a22e703711b1c (patch) | |
tree | bafb595dea147deb7ac77eeb4fcdb31ddddbc477 /libstdc++-v3/include/bits/stl_heap.h | |
parent | 84c7ea2e97ac3aa56f4a8ade20ceddc69f5bddba (diff) | |
download | gcc-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/stl_heap.h')
-rw-r--r-- | libstdc++-v3/include/bits/stl_heap.h | 72 |
1 files changed, 48 insertions, 24 deletions
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); } |