@@ -52,13 +52,13 @@ void load_actor_graph(std::istream& in, ActorGraph& g)
5252 // Map from the actor numbers on this line to the actor vertices
5353 typedef tokenizer< char_separator< char > > Tok;
5454 Tok tok (line, char_separator< char >(" " ));
55- for (Tok::iterator id = tok. begin (); id != tok. end (); ++id )
55+ for (const auto & id : tok)
5656 {
57- int actor_id = lexical_cast< int >(* id);
58- std::map< int , Vertex >::iterator v = actors.find (actor_id);
57+ auto actor_id = lexical_cast< int >(id);
58+ auto v = actors.find (actor_id);
5959 if (v == actors.end ())
6060 {
61- Vertex new_vertex = add_vertex (Actor (actor_id), g);
61+ auto new_vertex = add_vertex (Actor (actor_id), g);
6262 actors[actor_id] = new_vertex;
6363 actors_in_movie.push_back (new_vertex);
6464 }
@@ -68,11 +68,9 @@ void load_actor_graph(std::istream& in, ActorGraph& g)
6868 }
6969 }
7070
71- for (std::vector< Vertex >::iterator i = actors_in_movie.begin ();
72- i != actors_in_movie.end (); ++i)
71+ for (auto i = actors_in_movie.begin (); i != actors_in_movie.end (); ++i)
7372 {
74- for (std::vector< Vertex >::iterator j = i + 1 ;
75- j != actors_in_movie.end (); ++j)
73+ for (auto j = i + 1 ; j != actors_in_movie.end (); ++j)
7674 {
7775 if (!edge (*i, *j, g).second )
7876 add_edge (*i, *j, g);
@@ -86,16 +84,14 @@ std::ostream& write_pajek_graph(std::ostream& out, const Graph& g,
8684 VertexIndexMap vertex_index, VertexNameMap vertex_name)
8785{
8886 out << " *Vertices " << num_vertices (g) << ' \n ' ;
89- typedef typename graph_traits< Graph >::vertex_iterator vertex_iterator;
90- for (vertex_iterator v = vertices (g).first ; v != vertices (g).second ; ++v)
87+ for (auto v = vertices (g).first ; v != vertices (g).second ; ++v)
9188 {
9289 out << get (vertex_index, *v) + 1 << " \" " << get (vertex_name, *v)
9390 << " \"\n " ;
9491 }
9592
9693 out << " *Edges\n " ;
97- typedef typename graph_traits< Graph >::edge_iterator edge_iterator;
98- for (edge_iterator e = edges (g).first ; e != edges (g).second ; ++e)
94+ for (auto e = edges (g).first ; e != edges (g).second ; ++e)
9995 {
10096 out << get (vertex_index, source (*e, g)) + 1 << ' '
10197 << get (vertex_index, target (*e, g)) + 1 << " 1.0\n " ; // HACK!
0 commit comments