< Previous | Contents | Next >

Preparing to Use Algorithms

So that I can use the STL algorithms, I include the file with their definitions.

#include <algorithm>

As you know, all STL components live in the std namespace. By using the following code (as I typically do), I can refer to algorithms without having to precede them with std::.

using namespace std;

134 Chapter 4 n The Standard Template Library: Hangman