X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=libstdc%2B%2B-v3%2Fdoc%2Fhtml%2Fmanual%2Fbk01pt09pr02.html;fp=libstdc%2B%2B-v3%2Fdoc%2Fhtml%2Fmanual%2Fbk01pt09pr02.html;h=8321586d27a25fea87bb8d26b0e5d95324e9d3d3;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=0000000000000000000000000000000000000000;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libstdc++-v3/doc/html/manual/bk01pt09pr02.html b/libstdc++-v3/doc/html/manual/bk01pt09pr02.html new file mode 100644 index 00000000..8321586d --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt09pr02.html @@ -0,0 +1,41 @@ + + +
+ The neatest accomplishment of the algorithms chapter is that all the + work is done via iterators, not containers directly. This means two + important things: +
+ 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, as well as your own iterators. +
+ 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. +
+ Even strings can be fed through the algorithms here, although the
+ string class has specialized versions of many of these functions
+ (for example, string::find()
). Most of the examples
+ on this page will use simple arrays of integers as a playground
+ for algorithms, just to keep things simple. The use of
+ N as a size in the examples is to keep
+ things easy to read but probably won't be valid code. You can
+ use wrappers such as those described in the containers chapter to
+ keep real code readable.
+
+ The single thing that trips people up the most is the definition + of range used with iterators; the famous + "past-the-end" rule that everybody loves to hate. The + iterators + chapter of this document has a complete explanation of + this simple rule that seems to cause so much confusion. Once you + get range into your head (it's not that + hard, honest!), then the algorithms are a cakewalk. +