Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: gcc/libstdc++-v3/doc/html/manual/bk01pt09pr02.html

Issue 3050029: [gcc] GCC 4.5.0=>4.5.1 (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/nacl-toolchain.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or g/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" cont ent="DocBook XSL Stylesheets V1.74.0" /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; , &#10; algorithm&#10; " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation " /><link rel="up" href="algorithms.html" title="Part IX.  Algorithms" /><link r el="prev" href="algorithms.html" title="Part IX.  Algorithms" /><link rel="next" href="bk01pt09ch20.html" title="Chapter 20. Mutating" /></head><body><div class ="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href ="algorithms.html">Prev</a> </td><th width="60%" align="center">Part IX. 
4 Algorithms
5
6 </th><td width="20%" align="right"> <a accesskey="n" href="bk01pt09ch20.html">Ne xt</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en" ><div class="titlepage"><div><div><h2 class="title"><a id="id425058"></a></h2></ div></div></div><p>
7 The neatest accomplishment of the algorithms chapter is that all the
8 work is done via iterators, not containers directly. This means two
9 important things:
10 </p><div class="orderedlist"><ol type="1"><li><p>
11 Anything that behaves like an iterator can be used in one of
12 these algorithms. Raw pointers make great candidates, thus
13 built-in arrays are fine containers, as well as your own iterators.
14 </p></li><li><p>
15 The algorithms do not (and cannot) affect the container as a
16 whole; only the things between the two iterator endpoints. If
17 you pass a range of iterators only enclosing the middle third of
18 a container, then anything outside that range is inviolate.
19 </p></li></ol></div><p>
20 Even strings can be fed through the algorithms here, although the
21 string class has specialized versions of many of these functions
22 (for example, <code class="code">string::find()</code>). Most of the examp les
23 on this page will use simple arrays of integers as a playground
24 for algorithms, just to keep things simple. The use of
25 <span class="emphasis"><em>N</em></span> as a size in the examples is to ke ep
26 things easy to read but probably won't be valid code. You can
27 use wrappers such as those described in the <a class="ulink" href="../23_co ntainers/howto.html" target="_top">containers chapter</a> to
28 keep real code readable.
29 </p><p>
30 The single thing that trips people up the most is the definition
31 of <span class="emphasis"><em>range</em></span> used with iterators; the fa mous
32 "past-the-end" rule that everybody loves to hate. The
33 <a class="ulink" href="../24_iterators/howto.html#2" target="_top">iterator s
34 chapter</a> of this document has a complete explanation of
35 this simple rule that seems to cause so much confusion. Once you
36 get <span class="emphasis"><em>range</em></span> into your head (it's not t hat
37 hard, honest!), then the algorithms are a cakewalk.
38 </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigatio n footer"><tr><td width="40%" align="left"><a accesskey="p" href="algorithms.htm l">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="algorithm s.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt0 9ch20.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part  IX. 
39 Algorithms
40
41  </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home< /a></td><td width="40%" align="right" valign="top"> Chapter 20. Mutating</td></t r></table></div></body></html>
OLDNEW
« no previous file with comments | « gcc/libstdc++-v3/doc/html/manual/bk01pt05ch13s05.html ('k') | gcc/libstdc++-v3/doc/html/manual/bk01pt11ch25s02.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698