Chapter 25 deals with the generalized subroutines for automatically transforming lemmings into gold.
The neatest accomplishment of the algorithms chapter is that all the work is done via iterators, not containers directly. This means two important things:
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 legal 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.
Return to top of page or to the FAQ.
Blah.
Return to top of page or to the FAQ.
Comments and suggestions are welcome, and may be sent to
Phil Edwards or
Gabriel Dos Reis.
$Id: howto.html,v 1.2 2000/07/07 21:13:28 pme Exp $