::for_each(vertices(g).first, vertices(g).second,
                  exercise_vertex&lt;Graph&gt;(g));
    return 0;
  }
</pre>
<p>We use a functor for <tt>exercise_vertex</tt> instead of just a function
because the graph object will be needed when we access information about each
vertex; using a functor gives us a place to keep a reference to the graph object
during the execution of the <tt>std::for_each()</tt>. Also we template the
functor on the graph type so that it is reusable with different graph class