The last part of the textfile constructor calls the sort() function. This is an STL algorithm which works on the list and sorts the words alphabetically. It just requires two iterators links.begin() and links.end().
When I ran this on the cplus.about.com page that I had saved to disk it found 149 links. Don't forget if you use a path like c:\folder\file.htm that you must put it in the constructor as "c:\\folder\\file.htm".
Conclusion
This has been written for simplicity and could be improved considerably, however I wanted to show use of strings not the power of the STL. There are other classes such as streambuf, stringbuf and filebuf, all part of the iostream library that can make life even easier and in the next tutorial I'll look at those.That completes this tutorial. The next one will be on file I/O.

