@@ -52,13 +52,13 @@ void load_actor_graph(std::istream& in, ActorGraph& g)
52
52
// Map from the actor numbers on this line to the actor vertices
53
53
typedef tokenizer< char_separator< char > > Tok;
54
54
Tok tok (line, char_separator< char >(" " ));
55
- for (Tok::iterator id = tok. begin (); id != tok. end (); ++id )
55
+ for (const auto & id : tok)
56
56
{
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);
59
59
if (v == actors.end ())
60
60
{
61
- Vertex new_vertex = add_vertex (Actor (actor_id), g);
61
+ auto new_vertex = add_vertex (Actor (actor_id), g);
62
62
actors[actor_id] = new_vertex;
63
63
actors_in_movie.push_back (new_vertex);
64
64
}
@@ -68,11 +68,9 @@ void load_actor_graph(std::istream& in, ActorGraph& g)
68
68
}
69
69
}
70
70
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)
73
72
{
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)
76
74
{
77
75
if (!edge (*i, *j, g).second )
78
76
add_edge (*i, *j, g);
@@ -86,16 +84,14 @@ std::ostream& write_pajek_graph(std::ostream& out, const Graph& g,
86
84
VertexIndexMap vertex_index, VertexNameMap vertex_name)
87
85
{
88
86
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)
91
88
{
92
89
out << get (vertex_index, *v) + 1 << " \" " << get (vertex_name, *v)
93
90
<< " \"\n " ;
94
91
}
95
92
96
93
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)
99
95
{
100
96
out << get (vertex_index, source (*e, g)) + 1 << ' '
101
97
<< get (vertex_index, target (*e, g)) + 1 << " 1.0\n " ; // HACK!
0 commit comments