30a20a1ee0
2001-04-02 Phil Edwards <pme@sources.redhat.com> New concept checking implementation. * docs/html/19_diagnostics/howto.html: Document. * docs/html/17_intro/concept_check.diff: New file, for reference. * include/bits/boost_concept_check.h: New file from Boost. * include/bits/c++config: Update comments. * include/bits/concept_check.h: New file. * include/bits/concept_checks.h: Removed. * include/bits/container_concepts.h: Removed. * include/bits/sequence_concepts.h: Removed. * include/bits/stl_iterator_base.h: Removed; split into... * include/bits/stl_iterator_base_funcs.h: ...this new file... * include/bits/stl_iterator_base_types.h: ...and this new file. * include/bits/sbuf_iter.h: Update to use new implementation. * include/bits/std_iterator.h: Likewise. * include/bits/std_memory.h: Likewise. * include/bits/stl_algo.h: Likewise. * include/bits/stl_algobase.h: Likewise. * include/bits/stl_construct.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_heap.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_numeric.h: Likewise. * include/bits/stl_queue.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_stack.h: Likewise. * include/bits/stl_uninitialized.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/ext/hash_map: Likewise. * include/ext/hash_set: Likewise. * include/ext/slist: Likewise. * include/ext/stl_hashtable.h: Likewise. * src/Makefile.am (base_headers): Update list of headers. * Makefile.in: Regenerated. * src/Makefile.in: Regenerated. * libio/Makefile.in: Regenerated. * libmath/Makefile.in: Regenerated. * libsupc++/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * docs/html/install.html: Update contact information. * docs/html/17_intro/howto.html: Ditto. * docs/html/18_support/howto.html: Ditto. * docs/html/20_util/howto.html: Ditto. * docs/html/21_strings/howto.html: Ditto. * docs/html/22_locale/howto.html: Ditto. * docs/html/23_containers/howto.html: Ditto. * docs/html/24_iterators/howto.html: Ditto. * docs/html/25_algorithms/howto.html: Ditto. * docs/html/26_numerics/howto.html: Ditto. * docs/html/27_io/howto.html: Ditto. * docs/html/faq/index.html: Ditto, plus info on new checking code. * docs/html/ext/howto.html: Ditto, plus info on new checking code. * docs/html/faq/index.txt: Regenerated. From-SVN: r41031
96 lines
3.4 KiB
HTML
96 lines
3.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
|
<META NAME="AUTHOR" CONTENT="pme@sources.redhat.com (Phil Edwards)">
|
|
<META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
|
<META NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 25.">
|
|
<META NAME="GENERATOR" CONTENT="vi and eight fingers">
|
|
<TITLE>libstdc++-v3 HOWTO: Chapter 25</TITLE>
|
|
<LINK REL=StyleSheet HREF="../lib3styles.css">
|
|
<!-- $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $ -->
|
|
</HEAD>
|
|
<BODY>
|
|
|
|
<H1 CLASS="centered"><A NAME="top">Chapter 25: Algorithms</A></H1>
|
|
|
|
<P>Chapter 25 deals with the generalized subroutines for automatically
|
|
transforming lemmings into gold.
|
|
</P>
|
|
|
|
|
|
<!-- ####################################################### -->
|
|
<HR>
|
|
<H1>Contents</H1>
|
|
<UL>
|
|
<LI><A HREF="#1">Prerequisites</A>
|
|
<LI><A HREF="#2">Topic</A>
|
|
</UL>
|
|
|
|
<HR>
|
|
|
|
<!-- ####################################################### -->
|
|
|
|
<H2><A NAME="1">Prerequisites</A></H2>
|
|
<P>The neatest accomplishment of the algorithms chapter is that all the
|
|
work is done via iterators, not containers directly. This means two
|
|
important things:
|
|
<OL>
|
|
<LI>Anything that behaves like an iterator can be used in one of
|
|
these algorithms. Raw pointers make great candidates, thus
|
|
built-in arrays are fine containers. So do your own iterators.
|
|
<LI>The algorithms do not (and cannot) affect the container as a
|
|
whole; only the things between the two iterator endpoints. If
|
|
you pass a range of iterators only enclosing the middle third of
|
|
a container, then anything outside that range is inviolate.
|
|
</OL>
|
|
</P>
|
|
<P>Even strings can be fed through the algorithms here, although the
|
|
string class has specialized versions of many of these functions (for
|
|
example, <TT>string::find()</TT>). Most of the examples on this
|
|
page will use simple arrays of integers as a playground for
|
|
algorithms, just to keep things simple.
|
|
<A NAME="Nsize">The use of <B>N</B></A> as a size in the examples is
|
|
to keep things easy to read but probably won't be legal code. You can
|
|
use wrappers such as those described in the
|
|
<A HREF="../23_containers/howto.html">containers chapter</A> to keep
|
|
real code readable.
|
|
</P>
|
|
<P>The single thing that trips people up the most is the definition of
|
|
<EM>range</EM> used with iterators; the famous
|
|
"past-the-end" rule that everybody loves to hate. The
|
|
<A HREF="../24_iterators/howto.html">iterators chapter</A> of this
|
|
document has a complete explanation of this simple rule that seems to
|
|
cause so much confusion. Once you get <EM>range</EM> into your head
|
|
(it's not that hard, honest!), then the algorithms are a cakewalk.
|
|
</P>
|
|
<P>
|
|
</P>
|
|
<P>Return <A HREF="#top">to top of page</A> or
|
|
<A HREF="../faq/index.html">to the FAQ</A>.
|
|
</P>
|
|
|
|
<HR>
|
|
<H2><A NAME="2">Topic</A></H2>
|
|
<P>Blah.
|
|
</P>
|
|
<P>Return <A HREF="#top">to top of page</A> or
|
|
<A HREF="../faq/index.html">to the FAQ</A>.
|
|
</P>
|
|
|
|
|
|
|
|
|
|
<!-- ####################################################### -->
|
|
|
|
<HR>
|
|
<P CLASS="fineprint"><EM>
|
|
Comments and suggestions are welcome, and may be sent to
|
|
<A HREF="mailto:libstdc++@gcc.gnu.org">the mailing list</A>.
|
|
<BR> $Id: howto.html,v 1.1 2000/12/10 04:04:55 pme Exp $
|
|
</EM></P>
|
|
|
|
|
|
</BODY>
|
|
</HTML>
|