From 35f6a2dc2796cf066338aa1c314c20daeaa64482 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Wed, 4 May 2016 12:40:48 +0200 Subject: [PATCH] examples: C++11: Use using instead of typedef --- example/accum-compile-times.cpp | 28 +++---- example/actor_clustering.cpp | 13 ++- example/adj_list_ra_edgelist.cpp | 7 +- example/adjacency_list.cpp | 5 +- example/adjacency_list_io.cpp | 30 +++---- example/adjacency_matrix.cpp | 4 +- example/astar-cities.cpp | 17 ++-- example/astar_maze.cpp | 27 +++---- example/bellman-example.cpp | 6 +- example/bellman-ford-internet.cpp | 7 +- example/bfs-example.cpp | 15 ++-- example/bfs-example2.cpp | 19 +++-- example/bfs-name-printer.cpp | 4 +- example/bfs.cpp | 11 ++- example/bfs_neighbor.cpp | 11 ++- example/biconnected_components.cpp | 9 +-- example/bipartite_example.cpp | 20 ++--- example/boost_web_graph.cpp | 19 +++-- example/boykov_kolmogorov-eg.cpp | 8 +- example/bron_kerbosch_clique_number.cpp | 6 +- example/bron_kerbosch_print_cliques.cpp | 8 +- example/bucket_sorter.cpp | 7 +- example/canonical_ordering.cpp | 11 ++- example/city_visitor.cpp | 10 +-- example/closeness_centrality.cpp | 22 ++--- example/clustering_coefficient.cpp | 14 ++-- example/components_on_edgelist.cpp | 4 +- example/connected-components.cpp | 2 +- example/connected_components.cpp | 2 +- example/container_gen.cpp | 16 ++-- example/copy-example.cpp | 7 +- example/csr-example.cpp | 4 +- example/cuthill_mckee_ordering.cpp | 11 ++- example/cycle-file-dep.cpp | 16 ++-- example/cycle-file-dep2.cpp | 16 ++-- example/cycle_ratio_example.cpp | 11 ++- example/dag_shortest_paths.cpp | 5 +- example/dave.cpp | 21 +++-- example/default-constructor.cpp | 9 +-- example/default-constructor2.cpp | 11 ++- example/degree_centrality.cpp | 14 ++-- example/dfs-example.cpp | 14 ++-- example/dfs.cpp | 6 +- example/dfs_parenthesis.cpp | 8 +- example/dijkstra-example-listS.cpp | 11 ++- example/dijkstra-example.cpp | 9 +-- example/dijkstra-no-color-map-example.cpp | 9 +-- example/directed_graph.cpp | 2 +- example/eccentricity.cpp | 22 ++--- example/edge-connectivity.cpp | 24 +++--- example/edge-function.cpp | 9 +-- example/edge-iter-constructor.cpp | 9 +-- example/edge_basics.cpp | 8 +- example/edge_coloring.cpp | 7 +- example/edge_connectivity.cpp | 6 +- example/edge_iterator_constructor.cpp | 14 ++-- example/edge_property.cpp | 16 ++-- example/edmonds-karp-eg.cpp | 7 +- example/exterior_properties.cpp | 21 +++-- example/exterior_property_map.cpp | 4 +- example/fibonacci_heap.cpp | 2 +- example/file_dependencies.cpp | 8 +- example/filtered-copy-example.cpp | 7 +- example/filtered_graph.cpp | 7 +- example/filtered_graph_edge_range.cpp | 11 ++- example/filtered_vec_as_graph.cpp | 2 +- example/fr_layout.cpp | 22 +++-- example/gerdemann.cpp | 19 +++-- example/girth.cpp | 14 ++-- example/graph-assoc-types.cpp | 14 ++-- example/graph-property-iter-eg.cpp | 5 +- example/graph-thingie.cpp | 20 +++-- example/graph.cpp | 12 ++- example/graph_as_tree.cpp | 15 ++-- example/graph_property.cpp | 7 +- example/graphviz.cpp | 12 ++- example/grid_graph_example.cpp | 4 +- example/grid_graph_properties.cpp | 6 +- example/hawick_circuits.cpp | 4 +- example/helper.hpp | 18 ++--- example/implicit_graph.cpp | 84 ++++++++++---------- example/in_edges.cpp | 2 +- example/inclusive_mean_geodesic.cpp | 26 +++--- example/incremental-components-eg.cpp | 14 ++-- example/incremental_components.cpp | 12 +-- example/influence_prestige.cpp | 14 ++-- example/interior_pmap_bundled.cpp | 4 +- example/interior_property_map.cpp | 13 ++- example/isomorphism.cpp | 5 +- example/johnson-eg.cpp | 7 +- example/kevin-bacon.cpp | 9 +-- example/kevin-bacon2.cpp | 9 +-- example/king_ordering.cpp | 11 ++- example/knights_tour.cpp | 44 +++++----- example/kruskal-example.cpp | 9 +-- example/kruskal-telephone.cpp | 11 ++- example/kuratowski_subgraph.cpp | 9 +-- example/labeled_graph.cpp | 14 ++-- example/last-mod-time.cpp | 16 ++-- example/leda-concept-check.cpp | 2 +- example/leda-graph-eg.cpp | 4 +- example/loops_dfs.cpp | 17 ++-- example/make_biconnected_planar.cpp | 17 ++-- example/make_connected.cpp | 5 +- example/make_maximal_planar.cpp | 7 +- example/matching_example.cpp | 2 +- example/max_flow.cpp | 7 +- example/mcgregor_subgraphs_example.cpp | 18 ++--- example/mean_geodesic.cpp | 22 ++--- example/miles_span.cpp | 2 +- example/min_max_paths.cpp | 9 +-- example/minimum_degree_ordering.cpp | 4 +- example/modify_graph.cpp | 6 +- example/neighbor_bfs.cpp | 17 ++-- example/ordered_out_edges.cpp | 27 ++++--- example/ospf-example.cpp | 14 ++-- example/parallel-compile-time.cpp | 48 +++++------ example/planar_face_traversal.cpp | 7 +- example/prim-example.cpp | 7 +- example/prim-telephone.cpp | 7 +- example/print-adjacent-vertices.cpp | 9 +-- example/print-edges.cpp | 9 +-- example/print-in-edges.cpp | 9 +-- example/print-out-edges.cpp | 11 ++- example/property-map-traits-eg.cpp | 5 +- example/property_iterator.cpp | 25 +++--- example/push-relabel-eg.cpp | 7 +- example/put-get-helper-eg.cpp | 19 +++-- example/quick-tour.cpp | 7 +- example/quick_tour.cpp | 13 ++- example/r_c_shortest_paths_example.cpp | 5 +- example/reachable-loop-head.cpp | 2 +- example/reachable-loop-tail.cpp | 7 +- example/read_graphviz.cpp | 13 ++- example/read_write_dimacs-eg.cpp | 17 ++-- example/remove_edge_if_bidir.cpp | 7 +- example/remove_edge_if_dir.cpp | 4 +- example/remove_edge_if_undir.cpp | 7 +- example/reverse_graph.cpp | 2 +- example/roget_components.cpp | 2 +- example/scaled_closeness_centrality.cpp | 26 +++--- example/scc.cpp | 2 +- example/simple_planarity_test.cpp | 5 +- example/sloan_ordering.cpp | 11 ++- example/stoer_wagner.cpp | 12 +-- example/straight_line_drawing.cpp | 22 +++-- example/strong-components.cpp | 2 +- example/strong_components.cpp | 4 +- example/subgraph.cpp | 5 +- example/subgraph_properties.cpp | 12 ++- example/tiernan_girth_circumference.cpp | 6 +- example/tiernan_print_cycles.cpp | 6 +- example/topo-sort-file-dep.cpp | 16 ++-- example/topo-sort-file-dep2.cpp | 16 ++-- example/topo-sort-with-leda.cpp | 4 +- example/topo-sort-with-sgb.cpp | 2 +- example/topo_sort.cpp | 11 ++- example/transitive_closure.cpp | 8 +- example/transpose-example.cpp | 7 +- example/two_graphs_common_spanning_trees.cpp | 13 ++- example/undirected_adjacency_list.cpp | 14 ++-- example/undirected_dfs.cpp | 7 +- example/undirected_graph.cpp | 2 +- example/vector_as_graph.cpp | 2 +- example/vertex-name-property.cpp | 14 ++-- example/vertex_basics.cpp | 12 +-- example/vf2_sub_graph_iso_example.cpp | 2 +- example/vf2_sub_graph_iso_multi_example.cpp | 11 ++- example/visitor.cpp | 10 +-- example/weighted_matching_example.cpp | 8 +- example/write_graphviz.cpp | 7 +- 171 files changed, 912 insertions(+), 1011 deletions(-) diff --git a/example/accum-compile-times.cpp b/example/accum-compile-times.cpp index e220129e..0468fcee 100644 --- a/example/accum-compile-times.cpp +++ b/example/accum-compile-times.cpp @@ -35,25 +35,25 @@ BOOST_INSTALL_PROPERTY(vertex, compile_cost); using namespace boost; -typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list - listS, // Store vertex set in a std::list - directedS, // The file dependency graph is directed - // vertex properties - property< vertex_name_t, std::string, - property< vertex_compile_cost_t, float, - property< vertex_distance_t, float, - property< vertex_color_t, default_color_type > > > >, - // an edge property - property< edge_weight_t, float > > - file_dep_graph2; +using file_dep_graph2 + = adjacency_list< listS, // Store out-edges of each vertex in a std::list + listS, // Store vertex set in a std::list + directedS, // The file dependency graph is directed + // vertex properties + property< vertex_name_t, std::string, + property< vertex_compile_cost_t, float, + property< vertex_distance_t, float, + property< vertex_color_t, default_color_type > > > >, + // an edge property + property< edge_weight_t, float > >; -typedef graph_traits< file_dep_graph2 >::vertex_descriptor vertex_t; -typedef graph_traits< file_dep_graph2 >::edge_descriptor edge_t; +using vertex_t = graph_traits< file_dep_graph2 >::vertex_descriptor; +using edge_t = graph_traits< file_dep_graph2 >::edge_descriptor; int main(int argc, const char** argv) { std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"); - typedef graph_traits< file_dep_graph2 >::vertices_size_type size_type; + using size_type = graph_traits< file_dep_graph2 >::vertices_size_type; size_type n_vertices; file_in >> n_vertices; // read in number of vertices #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 diff --git a/example/actor_clustering.cpp b/example/actor_clustering.cpp index f23f7e3b..83da433f 100644 --- a/example/actor_clustering.cpp +++ b/example/actor_clustering.cpp @@ -34,11 +34,10 @@ struct Actor int id; }; -typedef adjacency_list< vecS, vecS, undirectedS, Actor, - property< edge_centrality_t, double > > - ActorGraph; -typedef graph_traits< ActorGraph >::vertex_descriptor Vertex; -typedef graph_traits< ActorGraph >::edge_descriptor Edge; +using ActorGraph = adjacency_list< vecS, vecS, undirectedS, Actor, + property< edge_centrality_t, double > >; +using Vertex = graph_traits< ActorGraph >::vertex_descriptor; +using Edge = graph_traits< ActorGraph >::edge_descriptor; void load_actor_graph(std::istream& in, ActorGraph& g) { @@ -50,7 +49,7 @@ void load_actor_graph(std::istream& in, ActorGraph& g) std::vector< Vertex > actors_in_movie; // Map from the actor numbers on this line to the actor vertices - typedef tokenizer< char_separator< char > > Tok; + using Tok = tokenizer< char_separator< char > >; Tok tok(line, char_separator< char >(" ")); for (auto const & id : tok) { @@ -101,7 +100,7 @@ std::ostream& write_pajek_graph(std::ostream& out, const Graph& g, class actor_clustering_threshold : public bc_clustering_threshold< double > { - typedef bc_clustering_threshold< double > inherited; + using inherited = bc_clustering_threshold< double >; public: actor_clustering_threshold( diff --git a/example/adj_list_ra_edgelist.cpp b/example/adj_list_ra_edgelist.cpp index d6380efa..13a1de1a 100644 --- a/example/adj_list_ra_edgelist.cpp +++ b/example/adj_list_ra_edgelist.cpp @@ -14,12 +14,11 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, bidirectionalS, no_property, - property< int, edge_weight_t >, no_property, vecS > - Graph; + using Graph = adjacency_list< vecS, vecS, bidirectionalS, no_property, + property< int, edge_weight_t >, no_property, vecS >; const std::size_t n = 3; - typedef std::pair< std::size_t, std::size_t > E; + using E = std::pair< std::size_t, std::size_t >; E edge_array[] = { E(0, 1), E(0, 2), E(0, 1) }; const std::size_t m = sizeof(edge_array) / sizeof(E); Graph g(edge_array, edge_array + m, n); diff --git a/example/adjacency_list.cpp b/example/adjacency_list.cpp index b8a984d6..82786c57 100644 --- a/example/adjacency_list.cpp +++ b/example/adjacency_list.cpp @@ -54,9 +54,8 @@ int main(int, char*[]) using namespace boost; using namespace std; - typedef adjacency_list< vecS, listS, undirectedS, VertexProperties, - EdgeProperties > - Graph; + using Graph = adjacency_list< vecS, listS, undirectedS, VertexProperties, + EdgeProperties >; const int V = 5; Graph g(V); diff --git a/example/adjacency_list_io.cpp b/example/adjacency_list_io.cpp index bfc0280c..18bbc483 100644 --- a/example/adjacency_list_io.cpp +++ b/example/adjacency_list_io.cpp @@ -37,7 +37,8 @@ struct n1_t { num = 23063 }; - typedef vertex_property_tag kind; + + using kind = vertex_property_tag; }; struct n2_t { @@ -45,7 +46,8 @@ struct n2_t { num = 23062 }; - typedef vertex_property_tag kind; + + using kind = vertex_property_tag; }; struct n3_t { @@ -53,11 +55,11 @@ struct n3_t { num = 23061 }; - typedef vertex_property_tag kind; + + using kind = vertex_property_tag; }; -typedef property< n1_t, int, - property< n2_t, double, property< n3_t, MyStruct > > > - VertexProperty; +using VertexProperty = property< n1_t, int, + property< n2_t, double, property< n3_t, MyStruct > > >; //====== edge properties struct e1_t @@ -66,18 +68,18 @@ struct e1_t { num = 23064 }; - typedef edge_property_tag kind; + + using kind = edge_property_tag; }; -typedef property< e1_t, double > EdgeProperty; +using EdgeProperty = property< e1_t, double >; //===== graph types -typedef adjacency_list< vecS, listS, directedS, no_property, no_property > - Graph1; +using Graph1 + = adjacency_list< vecS, listS, directedS, no_property, no_property >; -typedef adjacency_list< setS, setS, bidirectionalS, VertexProperty, - EdgeProperty > - Graph2; +using Graph2 = adjacency_list< setS, setS, bidirectionalS, VertexProperty, + EdgeProperty >; int main() { @@ -103,7 +105,7 @@ int main() // read Graph2, incomplete data in a different order. Write it diffently. Graph2 g31; std::ifstream readFile31("data3.txt"); - typedef property< n3_t, MyStruct, property< n1_t, int > > readNodeProp; + using readNodeProp = property< n3_t, MyStruct, property< n1_t, int > >; readFile31 >> read(g31, readNodeProp(), EdgeProperty()); std::cout << "graph g31 from file data3.txt:\n" << write(g31, property< n3_t, MyStruct >(), EdgeProperty()) diff --git a/example/adjacency_matrix.cpp b/example/adjacency_matrix.cpp index 4f36ead9..9ee907cc 100644 --- a/example/adjacency_matrix.cpp +++ b/example/adjacency_matrix.cpp @@ -28,7 +28,7 @@ int main() // A directed graph - typedef adjacency_matrix< directedS > Graph; + using Graph = adjacency_matrix< directedS >; Graph g(N); add_edge(B, C, g); add_edge(B, F, g); @@ -52,7 +52,7 @@ int main() // An undirected graph - typedef adjacency_matrix< undirectedS > UGraph; + using UGraph = adjacency_matrix< undirectedS >; UGraph ug(N); add_edge(B, C, ug); add_edge(B, F, ug); diff --git a/example/astar-cities.cpp b/example/astar-cities.cpp index 7c615ac9..42d0d016 100644 --- a/example/astar-cities.cpp +++ b/example/astar-cities.cpp @@ -30,7 +30,7 @@ struct location { float y, x; // lat, long }; -typedef float cost; +using cost = float; template < class Name, class LocMap > class city_writer { @@ -82,7 +82,7 @@ template < class Graph, class CostType, class LocMap > class distance_heuristic : public astar_heuristic< Graph, CostType > { public: - typedef typename graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = typename graph_traits< Graph >::vertex_descriptor; distance_heuristic(LocMap l, Vertex goal) : m_location(l), m_goal(goal) {} CostType operator()(Vertex u) { @@ -120,13 +120,12 @@ int main(int argc, char** argv) { // specify some types - typedef adjacency_list< listS, vecS, undirectedS, no_property, - property< edge_weight_t, cost > > - mygraph_t; - typedef property_map< mygraph_t, edge_weight_t >::type WeightMap; - typedef mygraph_t::vertex_descriptor vertex; - typedef mygraph_t::edge_descriptor edge_descriptor; - typedef std::pair< int, int > edge; + using mygraph_t = adjacency_list< listS, vecS, undirectedS, no_property, + property< edge_weight_t, cost > >; + using WeightMap = property_map< mygraph_t, edge_weight_t >::type; + using vertex = mygraph_t::vertex_descriptor; + using edge_descriptor = mygraph_t::edge_descriptor; + using edge = std::pair< int, int >; // specify data enum nodes diff --git a/example/astar_maze.cpp b/example/astar_maze.cpp index 089b569f..92701d60 100644 --- a/example/astar_maze.cpp +++ b/example/astar_maze.cpp @@ -45,18 +45,18 @@ boost::mt19937 random_generator; // Distance traveled in the maze -typedef double distance; +using distance = double; #define GRID_RANK 2 -typedef boost::grid_graph< GRID_RANK > grid; -typedef boost::graph_traits< grid >::vertex_descriptor vertex_descriptor; -typedef boost::graph_traits< grid >::vertices_size_type vertices_size_type; +using grid = boost::grid_graph< GRID_RANK >; +using vertex_descriptor = boost::graph_traits< grid >::vertex_descriptor; +using vertices_size_type = boost::graph_traits< grid >::vertices_size_type; // A hash function for vertices. struct vertex_hash { - typedef vertex_descriptor argument_type; - typedef std::size_t result_type; + using argument_type = vertex_descriptor; + using result_type = std::size_t; std::size_t operator()(vertex_descriptor const& u) const { std::size_t seed = 0; @@ -66,9 +66,9 @@ struct vertex_hash } }; -typedef boost::unordered_set< vertex_descriptor, vertex_hash > vertex_set; -typedef boost::vertex_subset_complement_filter< grid, vertex_set >::type - filtered_grid; +using vertex_set = boost::unordered_set< vertex_descriptor, vertex_hash >; +using filtered_grid + = boost::vertex_subset_complement_filter< grid, vertex_set >::type; // A searchable maze // @@ -190,14 +190,13 @@ bool maze::solve() { boost::static_property_map< distance > weight(1); // The predecessor map is a vertex-to-vertex mapping. - typedef boost::unordered_map< vertex_descriptor, vertex_descriptor, - vertex_hash > - pred_map; + using pred_map = boost::unordered_map< vertex_descriptor, vertex_descriptor, + vertex_hash >; pred_map predecessor; boost::associative_property_map< pred_map > pred_pmap(predecessor); // The distance map is a vertex-to-distance mapping. - typedef boost::unordered_map< vertex_descriptor, distance, vertex_hash > - dist_map; + using dist_map + = boost::unordered_map< vertex_descriptor, distance, vertex_hash >; dist_map distance; boost::associative_property_map< dist_map > dist_pmap(distance); diff --git a/example/bellman-example.cpp b/example/bellman-example.cpp index 2de9c352..57c5707d 100644 --- a/example/bellman-example.cpp +++ b/example/bellman-example.cpp @@ -56,14 +56,14 @@ int main() N }; char name[] = { 'u', 'v', 'x', 'y', 'z' }; - typedef std::pair< int, int > E; + using E = std::pair< int, int >; const int n_edges = 10; E edge_array[] = { E(u, y), E(u, x), E(u, v), E(v, u), E(x, y), E(x, v), E(y, v), E(y, z), E(z, u), E(z, x) }; int weight[n_edges] = { -4, 8, 5, -2, 9, -3, 7, 2, 6, 7 }; - typedef adjacency_list< vecS, vecS, directedS, no_property, EdgeProperties > - Graph; + using Graph + = adjacency_list< vecS, vecS, directedS, no_property, EdgeProperties >; #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // VC++ can't handle the iterator constructor Graph g(N); diff --git a/example/bellman-ford-internet.cpp b/example/bellman-ford-internet.cpp index 59edf76c..59438e92 100644 --- a/example/bellman-ford-internet.cpp +++ b/example/bellman-ford-internet.cpp @@ -25,7 +25,7 @@ int main() H, n_vertices }; - typedef std::pair< int, int > Edge; + using Edge = std::pair< int, int >; // The list of connections between routers stored in an array. Edge edges[] = { Edge(A, B), Edge(A, C), Edge(B, D), Edge(B, E), @@ -33,9 +33,8 @@ int main() Edge(G, H) }; // Specify the graph type and declare a graph object - typedef edge_list< Edge*, Edge, std::ptrdiff_t, - std::random_access_iterator_tag > - Graph; + using Graph = edge_list< Edge*, Edge, std::ptrdiff_t, + std::random_access_iterator_tag >; Graph g(std::begin(edges), std::end(edges)); // The transmission delay values for each edge. diff --git a/example/bfs-example.cpp b/example/bfs-example.cpp index c42bef15..1d783c59 100644 --- a/example/bfs-example.cpp +++ b/example/bfs-example.cpp @@ -16,7 +16,7 @@ using namespace boost; template < typename TimeMap > class bfs_time_visitor : public default_bfs_visitor { - typedef typename property_traits< TimeMap >::value_type T; + using T = typename property_traits< TimeMap >::value_type; public: bfs_time_visitor(TimeMap tmap, T& t) : m_timemap(tmap), m_time(t) {} @@ -33,7 +33,7 @@ int main() { using namespace boost; // Select the graph type we wish to use - typedef adjacency_list< vecS, vecS, undirectedS > graph_t; + using graph_t = adjacency_list< vecS, vecS, undirectedS >; // Set up the vertex IDs and names enum { @@ -49,7 +49,7 @@ int main() }; const char* name = "rstuvwxy"; // Specify the edges in the graph - typedef std::pair< int, int > E; + using E = std::pair< int, int >; E edge_array[] = { E(r, s), E(r, v), E(s, w), E(w, r), E(w, t), E(w, x), E(x, t), E(t, u), E(x, y), E(u, y) }; // Create the graph object @@ -60,18 +60,17 @@ int main() for (std::size_t j = 0; j < n_edges; ++j) add_edge(edge_array[j].first, edge_array[j].second, g); #else - typedef graph_traits< graph_t >::vertices_size_type v_size_t; + using v_size_t = graph_traits< graph_t >::vertices_size_type; graph_t g(edge_array, edge_array + n_edges, v_size_t(N)); #endif // Typedefs - typedef graph_traits< graph_t >::vertices_size_type Size; + using Size = graph_traits< graph_t >::vertices_size_type; // a vector to hold the discover time property for each vertex std::vector< Size > dtime(num_vertices(g)); - typedef iterator_property_map< std::vector< Size >::iterator, - property_map< graph_t, vertex_index_t >::const_type > - dtime_pm_type; + using dtime_pm_type = iterator_property_map< std::vector< Size >::iterator, + property_map< graph_t, vertex_index_t >::const_type >; dtime_pm_type dtime_pm(dtime.begin(), get(vertex_index, g)); Size time = 0; diff --git a/example/bfs-example2.cpp b/example/bfs-example2.cpp index 5bd66e39..1f2096b8 100644 --- a/example/bfs-example2.cpp +++ b/example/bfs-example2.cpp @@ -17,7 +17,7 @@ using namespace boost; template < typename TimeMap > class bfs_time_visitor : public default_bfs_visitor { - typedef typename property_traits< TimeMap >::value_type T; + using T = typename property_traits< TimeMap >::value_type; public: bfs_time_visitor(TimeMap tmap, T& t) : m_timemap(tmap), m_time(t) {} @@ -41,7 +41,7 @@ int main() { using namespace boost; // Select the graph type we wish to use - typedef adjacency_list< listS, listS, undirectedS, VertexProps > graph_t; + using graph_t = adjacency_list< listS, listS, undirectedS, VertexProps >; // Set up the vertex IDs and names enum { @@ -57,7 +57,7 @@ int main() }; const char* name = "rstuvwxy"; // Specify the edges in the graph - typedef std::pair< int, int > E; + using E = std::pair< int, int >; E edge_array[] = { E(r, s), E(r, v), E(s, w), E(w, r), E(w, t), E(w, x), E(x, t), E(t, u), E(x, y), E(u, y) }; // Create the graph object @@ -71,16 +71,16 @@ int main() for (std::size_t j = 0; j < n_edges; ++j) add_edge(verts[edge_array[j].first], verts[edge_array[j].second], g); #else - typedef graph_traits< graph_t >::vertices_size_type v_size_t; + using v_size_t = graph_traits< graph_t >::vertices_size_type; graph_t g(edge_array, edge_array + n_edges, v_size_t(N)); #endif // Typedefs - typedef graph_traits< graph_t >::vertices_size_type Size; + using Size = graph_traits< graph_t >::vertices_size_type; Size time = 0; - typedef property_map< graph_t, std::size_t VertexProps::* >::type - dtime_map_t; + using dtime_map_t + = property_map< graph_t, std::size_t VertexProps::* >::type; auto dtime_map = get(&VertexProps::discover_time, g); bfs_time_visitor< dtime_map_t > vis(dtime_map, time); breadth_first_search( @@ -88,9 +88,8 @@ int main() // a vector to hold the discover time property for each vertex std::vector< Size > dtime(num_vertices(g)); - typedef iterator_property_map< std::vector< Size >::iterator, - property_map< graph_t, unsigned int VertexProps::* >::type > - dtime_pm_type; + using dtime_pm_type = iterator_property_map< std::vector< Size >::iterator, + property_map< graph_t, unsigned int VertexProps::* >::type >; graph_traits< graph_t >::vertex_iterator vi, vi_end; std::size_t c = 0; for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi, ++c) diff --git a/example/bfs-name-printer.cpp b/example/bfs-name-printer.cpp index 5b19e9c0..b1c8ea6d 100644 --- a/example/bfs-name-printer.cpp +++ b/example/bfs-name-printer.cpp @@ -74,7 +74,7 @@ struct EP int main() { - typedef adjacency_list< listS, vecS, directedS, VP, EP > graph_t; + using graph_t = adjacency_list< listS, vecS, directedS, VP, EP >; graph_t g; auto name_map = get(&VP::name, g); @@ -82,7 +82,7 @@ int main() build_router_network(g, name_map, delay_map); - typedef property_map< graph_t, char VP::* >::type VertexNameMap; + using VertexNameMap = property_map< graph_t, char VP::* >::type; auto a = *vertices(g).first; bfs_name_printer< VertexNameMap > vis(name_map); std::cout << "BFS vertex discover order: "; diff --git a/example/bfs.cpp b/example/bfs.cpp index 09d7b094..5ddfc0eb 100644 --- a/example/bfs.cpp +++ b/example/bfs.cpp @@ -70,7 +70,7 @@ template < class NewGraph, class Tag > struct graph_copier : public boost::base_visitor< graph_copier< NewGraph, Tag > > { - typedef Tag event_filter; + using event_filter = Tag; graph_copier(NewGraph& graph) : new_g(graph) {} @@ -91,13 +91,12 @@ inline graph_copier< NewGraph, Tag > copy_graph(NewGraph& g, Tag) int main(int, char*[]) { - typedef boost::adjacency_list< boost::mapS, boost::vecS, + using Graph = boost::adjacency_list< boost::mapS, boost::vecS, boost::bidirectionalS, boost::property< boost::vertex_color_t, boost::default_color_type, boost::property< boost::vertex_degree_t, int, boost::property< boost::vertex_in_degree_t, int, - boost::property< boost::vertex_out_degree_t, int > > > > > - Graph; + boost::property< boost::vertex_out_degree_t, int > > > > >; Graph G(5); boost::add_edge(0, 2, G); @@ -112,7 +111,7 @@ int main(int, char*[]) boost::add_edge(4, 0, G); boost::add_edge(4, 1, G); - typedef Graph::vertex_descriptor Vertex; + using Vertex = Graph::vertex_descriptor; Graph G_copy(5); // Array to store predecessor (parent) of each vertex. This will be @@ -120,7 +119,7 @@ int main(int, char*[]) std::vector< Vertex > p(boost::num_vertices(G)); // VC++ version of std::vector has no ::pointer, so // I use ::value_type* instead. - typedef std::vector< Vertex >::value_type* Piter; + using Piter = std::vector< Vertex >::value_type*; // Array to store distances from the source to each vertex . We use // a built-in array here just for variety. This will also be used as diff --git a/example/bfs_neighbor.cpp b/example/bfs_neighbor.cpp index 5408246d..6994fa42 100644 --- a/example/bfs_neighbor.cpp +++ b/example/bfs_neighbor.cpp @@ -65,7 +65,7 @@ template < class NewGraph, class Tag > struct graph_copier : public boost::base_visitor< graph_copier< NewGraph, Tag > > { - typedef Tag event_filter; + using event_filter = Tag; graph_copier(NewGraph& graph) : new_g(graph) {} @@ -86,13 +86,12 @@ inline graph_copier< NewGraph, Tag > copy_graph(NewGraph& g, Tag) int main(int, char*[]) { - typedef boost::adjacency_list< boost::mapS, boost::vecS, + using Graph = boost::adjacency_list< boost::mapS, boost::vecS, boost::bidirectionalS, boost::property< boost::vertex_color_t, boost::default_color_type, boost::property< boost::vertex_degree_t, int, boost::property< boost::vertex_in_degree_t, int, - boost::property< boost::vertex_out_degree_t, int > > > > > - Graph; + boost::property< boost::vertex_out_degree_t, int > > > > >; Graph G(5); boost::add_edge(0, 2, G); @@ -107,14 +106,14 @@ int main(int, char*[]) boost::add_edge(4, 0, G); boost::add_edge(4, 1, G); - typedef Graph::vertex_descriptor Vertex; + using Vertex = Graph::vertex_descriptor; // Array to store predecessor (parent) of each vertex. This will be // used as a Decorator (actually, its iterator will be). std::vector< Vertex > p(boost::num_vertices(G)); // VC++ version of std::vector has no ::pointer, so // I use ::value_type* instead. - typedef std::vector< Vertex >::value_type* Piter; + using Piter = std::vector< Vertex >::value_type*; // Array to store distances from the source to each vertex . We use // a built-in array here just for variety. This will also be used as diff --git a/example/biconnected_components.cpp b/example/biconnected_components.cpp index 17380fd5..1efbb523 100644 --- a/example/biconnected_components.cpp +++ b/example/biconnected_components.cpp @@ -21,17 +21,16 @@ struct edge_component_t { num = 555 }; - typedef edge_property_tag kind; + using kind = edge_property_tag; } edge_component; } int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, undirectedS, no_property, - property< edge_component_t, std::size_t > > - graph_t; - typedef graph_traits< graph_t >::vertex_descriptor vertex_t; + using graph_t = adjacency_list< vecS, vecS, undirectedS, no_property, + property< edge_component_t, std::size_t > >; + using vertex_t = graph_traits< graph_t >::vertex_descriptor; graph_t g(9); add_edge(0, 5, g); add_edge(0, 1, g); diff --git a/example/bipartite_example.cpp b/example/bipartite_example.cpp index 99ac316f..9c2c78c0 100644 --- a/example/bipartite_example.cpp +++ b/example/bipartite_example.cpp @@ -20,7 +20,7 @@ using namespace boost; template < typename Graph > void print_bipartite(const Graph& g) { - typedef graph_traits< Graph > traits; + using traits = graph_traits< Graph >; typename traits::vertex_iterator vertex_iter, vertex_end; /// Most simple interface just tests for bipartiteness. @@ -29,11 +29,11 @@ template < typename Graph > void print_bipartite(const Graph& g) if (bipartite) { - typedef std::vector< default_color_type > partition_t; - typedef - typename property_map< Graph, vertex_index_t >::type index_map_t; - typedef iterator_property_map< partition_t::iterator, index_map_t > - partition_map_t; + using partition_t = std::vector< default_color_type >; + using index_map_t = + typename property_map< Graph, vertex_index_t >::type; + using partition_map_t + = iterator_property_map< partition_t::iterator, index_map_t >; partition_t partition(num_vertices(g)); partition_map_t partition_map(partition.begin(), get(vertex_index, g)); @@ -57,8 +57,8 @@ template < typename Graph > void print_bipartite(const Graph& g) } else { - typedef std::vector< typename traits::vertex_descriptor > - vertex_vector_t; + using vertex_vector_t + = std::vector< typename traits::vertex_descriptor >; vertex_vector_t odd_cycle; /// A third interface yields an odd-cycle if the graph is not bipartite. @@ -76,8 +76,8 @@ template < typename Graph > void print_bipartite(const Graph& g) int main(int argc, char** argv) { - typedef adjacency_list< vecS, vecS, undirectedS > vector_graph_t; - typedef std::pair< int, int > E; + using vector_graph_t = adjacency_list< vecS, vecS, undirectedS >; + using E = std::pair< int, int >; /** * Create the graph drawn below. diff --git a/example/boost_web_graph.cpp b/example/boost_web_graph.cpp index cae0cfab..3cc681f4 100644 --- a/example/boost_web_graph.cpp +++ b/example/boost_web_graph.cpp @@ -47,7 +47,7 @@ public: void discover_vertex( typename boost::graph_traits< Graph >::vertex_descriptor v, Graph&) { - typedef typename boost::property_traits< DistanceMap >::value_type Dist; + using Dist = typename boost::property_traits< DistanceMap >::value_type; // indentation based on depth for (Dist i = 0; i < distance[v]; ++i) std::cout << " "; @@ -80,17 +80,16 @@ int main(int argc, const char** argv) //=========================================================================== // Declare the graph type and object, and some property maps. - typedef adjacency_list< vecS, vecS, directedS, + using Graph = adjacency_list< vecS, vecS, directedS, property< vertex_name_t, std::string, property< vertex_color_t, default_color_type > >, - property< edge_name_t, std::string, property< edge_weight_t, int > > > - Graph; + property< edge_name_t, std::string, property< edge_weight_t, int > > >; - typedef graph_traits< Graph > Traits; - typedef Traits::vertex_descriptor Vertex; - typedef Traits::edge_descriptor Edge; + using Traits = graph_traits< Graph >; + using Vertex = Traits::vertex_descriptor; + using Edge = Traits::edge_descriptor; - typedef std::map< std::string, Vertex > NameVertexMap; + using NameVertexMap = std::map< std::string, Vertex >; NameVertexMap name2vertex; Graph g; @@ -149,8 +148,8 @@ int main(int argc, const char** argv) //=========================================================================== // Calculate the diameter of the graph. - typedef Traits::vertices_size_type size_type; - typedef std::vector< size_type > IntVector; + using size_type = Traits::vertices_size_type; + using IntVector = std::vector< size_type >; // Create N x N matrix for storing the shortest distances // between each vertex. Initialize all distances to zero. std::vector< IntVector > d_matrix( diff --git a/example/boykov_kolmogorov-eg.cpp b/example/boykov_kolmogorov-eg.cpp index 67b1bfcd..0fb82870 100644 --- a/example/boykov_kolmogorov-eg.cpp +++ b/example/boykov_kolmogorov-eg.cpp @@ -70,19 +70,17 @@ int main() { using namespace boost; - typedef adjacency_list_traits< vecS, vecS, directedS > Traits; - typedef adjacency_list< vecS, vecS, directedS, + using Traits = adjacency_list_traits< vecS, vecS, directedS >; + using Graph = adjacency_list< vecS, vecS, directedS, property< vertex_name_t, std::string, property< vertex_index_t, long, property< vertex_color_t, boost::default_color_type, property< vertex_distance_t, long, property< vertex_predecessor_t, Traits::edge_descriptor > > > > >, - property< edge_capacity_t, long, property< edge_residual_capacity_t, long, - property< edge_reverse_t, Traits::edge_descriptor > > > > - Graph; + property< edge_reverse_t, Traits::edge_descriptor > > > >; Graph g; auto capacity = get(edge_capacity, g); diff --git a/example/bron_kerbosch_clique_number.cpp b/example/bron_kerbosch_clique_number.cpp index f8251df4..f21fdcf2 100644 --- a/example/bron_kerbosch_clique_number.cpp +++ b/example/bron_kerbosch_clique_number.cpp @@ -18,9 +18,9 @@ using namespace std; using namespace boost; // Declare the graph type and its vertex and edge types. -typedef undirected_graph<> Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = undirected_graph<>; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; int main(int argc, char* argv[]) { diff --git a/example/bron_kerbosch_print_cliques.cpp b/example/bron_kerbosch_print_cliques.cpp index 21c83b69..f656ffba 100644 --- a/example/bron_kerbosch_print_cliques.cpp +++ b/example/bron_kerbosch_print_cliques.cpp @@ -42,13 +42,13 @@ struct Actor }; // Declare the graph type and its vertex and edge types. -typedef undirected_graph< Actor > Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = undirected_graph< Actor >; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; // The name map provides an abstract accessor for the names of // each vertex. This is used during graph creation. -typedef property_map< Graph, string Actor::* >::type NameMap; +using NameMap = property_map< Graph, string Actor::* >::type; int main(int argc, char* argv[]) { diff --git a/example/bucket_sorter.cpp b/example/bucket_sorter.cpp index fdc91f88..9368fbad 100644 --- a/example/bucket_sorter.cpp +++ b/example/bucket_sorter.cpp @@ -29,10 +29,9 @@ int main() cout << "Number " << i << " is in bucket " << bucket[i] << endl; } - typedef boost::identity_property_map ID; - typedef bucket_sorter< std::size_t, int, vector< std::size_t >::iterator, - ID > - BS; + using ID = boost::identity_property_map; + using BS = bucket_sorter< std::size_t, int, vector< std::size_t >::iterator, + ID >; BS my_bucket_sorter(N, N, bucket.begin()); for (std::size_t ii = 0; ii < N; ii++) diff --git a/example/canonical_ordering.cpp b/example/canonical_ordering.cpp index ffcb9631..87d99011 100644 --- a/example/canonical_ordering.cpp +++ b/example/canonical_ordering.cpp @@ -21,9 +21,8 @@ using namespace boost; int main(int argc, char** argv) { - typedef adjacency_list< vecS, vecS, undirectedS, - property< vertex_index_t, int >, property< edge_index_t, int > > - graph; + using graph = adjacency_list< vecS, vecS, undirectedS, + property< vertex_index_t, int >, property< edge_index_t, int > >; // Create a maximal planar graph on 6 vertices graph g(6); @@ -52,7 +51,7 @@ int main(int argc, char** argv) // Test for planarity - we know it is planar, we just want to // compute the planar embedding as a side-effect - typedef std::vector< graph_traits< graph >::edge_descriptor > vec_t; + using vec_t = std::vector< graph_traits< graph >::edge_descriptor >; std::vector< vec_t > embedding(num_vertices(g)); if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g, boyer_myrvold_params::embedding = make_iterator_property_map( @@ -61,8 +60,8 @@ int main(int argc, char** argv) else std::cout << "Input graph is not planar" << std::endl; - typedef std::vector< graph_traits< graph >::vertex_descriptor > - ordering_storage_t; + using ordering_storage_t + = std::vector< graph_traits< graph >::vertex_descriptor >; ordering_storage_t ordering; planar_canonical_ordering(g, diff --git a/example/city_visitor.cpp b/example/city_visitor.cpp index 4b72bf33..f6338804 100644 --- a/example/city_visitor.cpp +++ b/example/city_visitor.cpp @@ -56,7 +56,7 @@ using namespace boost; struct city_arrival : public base_visitor< city_arrival > { city_arrival(string* n) : names(n) {} - typedef on_discover_vertex event_filter; + using event_filter = on_discover_vertex; template < class Vertex, class Graph > inline void operator()(Vertex u, Graph&) { @@ -70,7 +70,7 @@ struct city_arrival : public base_visitor< city_arrival > struct neighbor_cities : public base_visitor< neighbor_cities > { neighbor_cities(string* n) : names(n) {} - typedef on_examine_edge event_filter; + using event_filter = on_examine_edge; template < class Edge, class Graph > inline void operator()(Edge e, Graph& g) { @@ -82,7 +82,7 @@ struct neighbor_cities : public base_visitor< neighbor_cities > struct finish_city : public base_visitor< finish_city > { finish_city(string* n) : names(n) {} - typedef on_finish_vertex event_filter; + using event_filter = on_finish_vertex; template < class Vertex, class Graph > inline void operator()(Vertex u, Graph&) { @@ -113,14 +113,14 @@ int main(int, char*[]) = { "San Jose", "San Francisco", "Los Angeles", "San Diego", "Fresno", "Las Vegas", "Reno", "Sacramento", "Salt Lake City", "Phoenix" }; - typedef std::pair< int, int > E; + using E = std::pair< int, int >; E edge_array[] = { E(Sacramento, Reno), E(Sacramento, SanFran), E(Reno, SaltLake), E(SanFran, SanJose), E(SanJose, Fresno), E(SanJose, LA), E(LA, LasVegas), E(LA, SanDiego), E(LasVegas, Phoenix) }; /* Create the graph type we want. */ - typedef adjacency_list< vecS, vecS, undirectedS > Graph; + using Graph = adjacency_list< vecS, vecS, undirectedS >; #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // VC++ has trouble with the edge iterator constructor Graph G(N); diff --git a/example/closeness_centrality.cpp b/example/closeness_centrality.cpp index 9703bf3d..4181448c 100644 --- a/example/closeness_centrality.cpp +++ b/example/closeness_centrality.cpp @@ -25,29 +25,29 @@ struct Actor }; // Declare the graph type and its vertex and edge types. -typedef undirected_graph< Actor > Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = undirected_graph< Actor >; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; // The name map provides an abstract accessor for the names of // each vertex. This is used during graph creation. -typedef property_map< Graph, string Actor::* >::type NameMap; +using NameMap = property_map< Graph, string Actor::* >::type; // Declare a matrix type and its corresponding property map that // will contain the distances between each pair of vertices. -typedef exterior_vertex_property< Graph, int > DistanceProperty; -typedef DistanceProperty::matrix_type DistanceMatrix; -typedef DistanceProperty::matrix_map_type DistanceMatrixMap; +using DistanceProperty = exterior_vertex_property< Graph, int >; +using DistanceMatrix = DistanceProperty::matrix_type; +using DistanceMatrixMap = DistanceProperty::matrix_map_type; // Declare the weight map so that each edge returns the same value. -typedef constant_property_map< Edge, int > WeightMap; +using WeightMap = constant_property_map< Edge, int >; // Declare a container and its corresponding property map that // will contain the resulting closeness centralities of each // vertex in the graph. -typedef boost::exterior_vertex_property< Graph, float > ClosenessProperty; -typedef ClosenessProperty::container_type ClosenessContainer; -typedef ClosenessProperty::map_type ClosenessMap; +using ClosenessProperty = boost::exterior_vertex_property< Graph, float >; +using ClosenessContainer = ClosenessProperty::container_type; +using ClosenessMap = ClosenessProperty::map_type; int main(int argc, char* argv[]) { diff --git a/example/clustering_coefficient.cpp b/example/clustering_coefficient.cpp index 4c05c2a2..4b64e1f5 100644 --- a/example/clustering_coefficient.cpp +++ b/example/clustering_coefficient.cpp @@ -23,19 +23,19 @@ struct Actor }; // Declare the graph type and its vertex and edge types. -typedef undirected_graph< Actor > Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = undirected_graph< Actor >; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; // The name map provides an abstract accessor for the names of // each vertex. This is used during graph creation. -typedef property_map< Graph, string Actor::* >::type NameMap; +using NameMap = property_map< Graph, string Actor::* >::type; // The clustering property, container, and map define the containment // and abstract accessor for the clustering coefficients of vertices. -typedef exterior_vertex_property< Graph, float > ClusteringProperty; -typedef ClusteringProperty::container_type ClusteringContainer; -typedef ClusteringProperty::map_type ClusteringMap; +using ClusteringProperty = exterior_vertex_property< Graph, float >; +using ClusteringContainer = ClusteringProperty::container_type; +using ClusteringMap = ClusteringProperty::map_type; int main(int argc, char* argv[]) { diff --git a/example/components_on_edgelist.cpp b/example/components_on_edgelist.cpp index 23340514..7c0045a1 100644 --- a/example/components_on_edgelist.cpp +++ b/example/components_on_edgelist.cpp @@ -54,8 +54,8 @@ using boost::tie; int main(int, char*[]) { using namespace boost; - typedef int Index; // ID of a Vertex - typedef pair< Index, Index > Edge; + using Index = int; // ID of a Vertex + using Edge = pair< Index, Index >; const int N = 6; const int E = 4; Edge edgelist[] = { Edge(0, 1), Edge(1, 4), Edge(4, 0), Edge(2, 5) }; diff --git a/example/connected-components.cpp b/example/connected-components.cpp index 396abb3f..051b4765 100644 --- a/example/connected-components.cpp +++ b/example/connected-components.cpp @@ -14,7 +14,7 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, undirectedS > Graph; + using Graph = adjacency_list< vecS, vecS, undirectedS >; const int N = 6; Graph G(N); diff --git a/example/connected_components.cpp b/example/connected_components.cpp index 8fd6efc4..5bb65b33 100644 --- a/example/connected_components.cpp +++ b/example/connected_components.cpp @@ -40,7 +40,7 @@ int main(int, char*[]) { using namespace boost; { - typedef adjacency_list< vecS, vecS, undirectedS > Graph; + using Graph = adjacency_list< vecS, vecS, undirectedS >; Graph G; add_edge(0, 1, G); diff --git a/example/container_gen.cpp b/example/container_gen.cpp index 55d372a3..fbb61a69 100644 --- a/example/container_gen.cpp +++ b/example/container_gen.cpp @@ -21,24 +21,24 @@ template < class Alloc, class ValueType > struct container_gen< list_with_allocatorS< Alloc >, ValueType > { #ifdef BOOST_NO_CXX11_ALLOCATOR - typedef typename Alloc::template rebind< ValueType >::other Allocator; + using Allocator = typename Alloc::template rebind< ValueType >::other; #else - typedef typename std::allocator_traits::template rebind_alloc Allocator; + using Allocator = typename std::allocator_traits< + Alloc >::template rebind_alloc< ValueType >; #endif - typedef std::list< ValueType, Allocator > type; + using type = std::list< ValueType, Allocator >; }; template < class Alloc > struct parallel_edge_traits< list_with_allocatorS< Alloc > > { - typedef allow_parallel_edge_tag type; + using type = allow_parallel_edge_tag; }; - } // now you can define a graph using std::list and a specific allocator -typedef boost::adjacency_list< list_with_allocatorS< std::allocator< int > >, - boost::vecS, boost::directedS > - MyGraph; +using MyGraph + = boost::adjacency_list< list_with_allocatorS< std::allocator< int > >, + boost::vecS, boost::directedS >; int main(int, char*[]) { diff --git a/example/copy-example.cpp b/example/copy-example.cpp index 9a0b345d..a4178072 100644 --- a/example/copy-example.cpp +++ b/example/copy-example.cpp @@ -14,9 +14,8 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, directedS, - property< vertex_name_t, char > > - graph_t; + using graph_t = adjacency_list< vecS, vecS, directedS, + property< vertex_name_t, char > >; enum { @@ -36,7 +35,7 @@ int main() for (boost::tie(v, v_end) = vertices(G); v != v_end; ++v, ++name) name_map[*v] = name; - typedef std::pair< int, int > E; + using E = std::pair< int, int >; E edges[] = { E(a, c), E(a, d), E(b, a), E(b, d), E(c, f), E(d, c), E(d, e), E(d, f), E(e, b), E(e, g), E(f, e), E(f, g) }; for (int i = 0; i < 12; ++i) diff --git a/example/csr-example.cpp b/example/csr-example.cpp index a471e699..456ccd82 100644 --- a/example/csr-example.cpp +++ b/example/csr-example.cpp @@ -24,7 +24,7 @@ public: int main() { - typedef std::pair< int, int > E; + using E = std::pair< int, int >; const char* urls[6] = { "http://www.boost.org/libs/graph/doc/index.html", "http://www.boost.org/libs/graph/doc/table_of_contents.html", @@ -37,7 +37,7 @@ int main() E the_edges[] = { E(0, 1), E(0, 2), E(0, 3), E(1, 0), E(1, 3), E(1, 5), E(2, 0), E(2, 5), E(3, 1), E(3, 4), E(4, 1), E(5, 0), E(5, 2) }; - typedef compressed_sparse_row_graph< directedS, WebPage > WebGraph; + using WebGraph = compressed_sparse_row_graph< directedS, WebPage >; WebGraph g(boost::edges_are_sorted, &the_edges[0], &the_edges[0] + sizeof(the_edges) / sizeof(E), 6); diff --git a/example/cuthill_mckee_ordering.cpp b/example/cuthill_mckee_ordering.cpp index 3ca7e028..7f0b9a06 100644 --- a/example/cuthill_mckee_ordering.cpp +++ b/example/cuthill_mckee_ordering.cpp @@ -33,14 +33,13 @@ int main(int, char*[]) { using namespace boost; using namespace std; - typedef adjacency_list< vecS, vecS, undirectedS, + using Graph = adjacency_list< vecS, vecS, undirectedS, property< vertex_color_t, default_color_type, - property< vertex_degree_t, int > > > - Graph; - typedef graph_traits< Graph >::vertex_descriptor Vertex; - typedef graph_traits< Graph >::vertices_size_type size_type; + property< vertex_degree_t, int > > >; + using Vertex = graph_traits< Graph >::vertex_descriptor; + using size_type = graph_traits< Graph >::vertices_size_type; - typedef std::pair< std::size_t, std::size_t > Pair; + using Pair = std::pair< std::size_t, std::size_t >; Pair edges[14] = { Pair(0, 3), // a-d Pair(0, 5), // a-f Pair(1, 2), // b-c diff --git a/example/cycle-file-dep.cpp b/example/cycle-file-dep.cpp index a1d55ef7..e6d275d4 100644 --- a/example/cycle-file-dep.cpp +++ b/example/cycle-file-dep.cpp @@ -24,14 +24,14 @@ std::istream& operator>>(std::istream& in, std::pair< T, T >& p) } } -typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list - vecS, // Store vertex set in a std::vector - directedS // The file dependency graph is directed - > - file_dep_graph; +using file_dep_graph + = adjacency_list< listS, // Store out-edges of each vertex in a std::list + vecS, // Store vertex set in a std::vector + directedS // The file dependency graph is directed + >; -typedef graph_traits< file_dep_graph >::vertex_descriptor vertex_t; -typedef graph_traits< file_dep_graph >::edge_descriptor edge_t; +using vertex_t = graph_traits< file_dep_graph >::vertex_descriptor; +using edge_t = graph_traits< file_dep_graph >::edge_descriptor; bool has_cycle_dfs( const file_dep_graph& g, vertex_t u, default_color_type* color) @@ -64,7 +64,7 @@ bool has_cycle(const file_dep_graph& g) int main(int argc, const char** argv) { std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"); - typedef graph_traits< file_dep_graph >::vertices_size_type size_type; + using size_type = graph_traits< file_dep_graph >::vertices_size_type; size_type n_vertices; file_in >> n_vertices; // read in number of vertices std::istream_iterator< std::pair< size_type, size_type > > input_begin( diff --git a/example/cycle-file-dep2.cpp b/example/cycle-file-dep2.cpp index 678727a2..243cdd8e 100644 --- a/example/cycle-file-dep2.cpp +++ b/example/cycle-file-dep2.cpp @@ -26,14 +26,14 @@ std::istream& operator>>(std::istream& in, std::pair< T, T >& p) } } -typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list - vecS, // Store vertex set in a std::vector - directedS // The file dependency graph is directed - > - file_dep_graph; +using file_dep_graph + = adjacency_list< listS, // Store out-edges of each vertex in a std::list + vecS, // Store vertex set in a std::vector + directedS // The file dependency graph is directed + >; -typedef graph_traits< file_dep_graph >::vertex_descriptor vertex_t; -typedef graph_traits< file_dep_graph >::edge_descriptor edge_t; +using vertex_t = graph_traits< file_dep_graph >::vertex_descriptor; +using edge_t = graph_traits< file_dep_graph >::edge_descriptor; template < typename Visitor > void dfs_v1( @@ -103,7 +103,7 @@ bool has_cycle(const file_dep_graph& g) int main(int argc, const char** argv) { std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"); - typedef graph_traits< file_dep_graph >::vertices_size_type size_type; + using size_type = graph_traits< file_dep_graph >::vertices_size_type; size_type n_vertices; file_in >> n_vertices; // read in number of vertices std::istream_iterator< std::pair< size_type, size_type > > input_begin( diff --git a/example/cycle_ratio_example.cpp b/example/cycle_ratio_example.cpp index 0f73b35f..c7a295f3 100644 --- a/example/cycle_ratio_example.cpp +++ b/example/cycle_ratio_example.cpp @@ -18,10 +18,9 @@ */ using namespace boost; -typedef adjacency_list< listS, listS, directedS, - property< vertex_index_t, int >, - property< edge_weight_t, double, property< edge_weight2_t, double > > > - grap_real_t; +using grap_real_t + = adjacency_list< listS, listS, directedS, property< vertex_index_t, int >, + property< edge_weight_t, double, property< edge_weight2_t, double > > >; template < typename TG > void gen_rand_graph(TG& g, size_t nV, size_t nE) { @@ -45,8 +44,8 @@ int main(int argc, char* argv[]) using std::endl; const double epsilon = 0.0000001; double min_cr, max_cr; /// Minimum and maximum cycle ratio - typedef std::vector< graph_traits< grap_real_t >::edge_descriptor > - ccReal_t; + using ccReal_t + = std::vector< graph_traits< grap_real_t >::edge_descriptor >; ccReal_t cc; /// critical cycle grap_real_t tgr; diff --git a/example/dag_shortest_paths.cpp b/example/dag_shortest_paths.cpp index 016c4ac6..fe459ab7 100644 --- a/example/dag_shortest_paths.cpp +++ b/example/dag_shortest_paths.cpp @@ -25,9 +25,8 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, directedS, - property< vertex_distance_t, int >, property< edge_weight_t, int > > - graph_t; + using graph_t = adjacency_list< vecS, vecS, directedS, + property< vertex_distance_t, int >, property< edge_weight_t, int > >; graph_t g(6); enum verts { diff --git a/example/dave.cpp b/example/dave.cpp index 74e9322c..dec8b253 100644 --- a/example/dave.cpp +++ b/example/dave.cpp @@ -71,18 +71,17 @@ b(14); d a */ -typedef property< vertex_color_t, default_color_type, - property< vertex_distance_t, int > > - VProperty; -typedef int weight_t; -typedef property< edge_weight_t, weight_t > EProperty; +using VProperty = property< vertex_color_t, default_color_type, + property< vertex_distance_t, int > >; +using weight_t = int; +using EProperty = property< edge_weight_t, weight_t >; -typedef adjacency_list< vecS, vecS, directedS, VProperty, EProperty > Graph; +using Graph = adjacency_list< vecS, vecS, directedS, VProperty, EProperty >; template < class Tag > struct endl_printer : public boost::base_visitor< endl_printer< Tag > > { - typedef Tag event_filter; + using event_filter = Tag; endl_printer(std::ostream& os) : m_os(os) {} template < class T, class Graph > void operator()(T, Graph&) { @@ -98,7 +97,7 @@ template < class Tag > endl_printer< Tag > print_endl(std::ostream& os, Tag) template < class PA, class Tag > struct edge_printer : public boost::base_visitor< edge_printer< PA, Tag > > { - typedef Tag event_filter; + using event_filter = Tag; edge_printer(PA pa, std::ostream& os) : m_pa(pa), m_os(os) {} @@ -120,7 +119,7 @@ template < class NewGraph, class Tag > struct graph_copier : public boost::base_visitor< graph_copier< NewGraph, Tag > > { - typedef Tag event_filter; + using event_filter = Tag; graph_copier(NewGraph& graph) : new_g(graph) {} @@ -172,10 +171,10 @@ int main(int, char*[]) auto vertex_id = get(vertex_index, G); std::vector< weight_t > distance(N, (numeric_limits< weight_t >::max)()); - typedef boost::graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = boost::graph_traits< Graph >::vertex_descriptor; std::vector< Vertex > parent(N); - typedef std::pair< int, int > E; + using E = std::pair< int, int >; E edges[] = { E(a, c), E(a, d), E(b, a), E(b, d), E(c, f), E(d, c), E(d, e), E(d, f), E(e, b), E(e, g), E(f, e), E(f, g) }; diff --git a/example/default-constructor.cpp b/example/default-constructor.cpp index 71d9b3ef..0172538d 100644 --- a/example/default-constructor.cpp +++ b/example/default-constructor.cpp @@ -13,7 +13,7 @@ using namespace boost; template < typename Graph > void read_graph_file(std::istream& in, Graph& g) { - typedef typename graph_traits< Graph >::vertices_size_type size_type; + using size_type = typename graph_traits< Graph >::vertices_size_type; size_type n_vertices; in >> n_vertices; // read in number of vertices for (size_type i = 0; i < n_vertices; ++i) // Add n vertices to the graph @@ -28,12 +28,11 @@ template < typename Graph > void read_graph_file(std::istream& in, Graph& g) int main(int argc, const char** argv) { - typedef adjacency_list< listS, // Store out-edges of each vertex in a - // std::list + using graph_type = adjacency_list< listS, // Store out-edges of each vertex + // in a std::list vecS, // Store vertex set in a std::vector directedS // The graph is directed - > - graph_type; + >; graph_type g; // use default constructor to create empty graph std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"); diff --git a/example/default-constructor2.cpp b/example/default-constructor2.cpp index 18f88605..e6f4983c 100644 --- a/example/default-constructor2.cpp +++ b/example/default-constructor2.cpp @@ -13,8 +13,8 @@ using namespace boost; template < typename Graph > void read_graph_file(std::istream& in, Graph& g) { - typedef typename graph_traits< Graph >::vertex_descriptor Vertex; - typedef typename graph_traits< Graph >::vertices_size_type size_type; + using Vertex = typename graph_traits< Graph >::vertex_descriptor; + using size_type = typename graph_traits< Graph >::vertices_size_type; size_type n_vertices; in >> n_vertices; // read in number of vertices std::vector< Vertex > vertex_set(n_vertices); @@ -31,12 +31,11 @@ template < typename Graph > void read_graph_file(std::istream& in, Graph& g) int main(int argc, const char** argv) { - typedef adjacency_list< listS, // Store out-edges of each vertex in a - // std::list + using graph_type = adjacency_list< listS, // Store out-edges of each vertex + // in a std::list vecS, // Store vertex set in a std::vector directedS // The graph is directed - > - graph_type; + >; graph_type g; // use default constructor to create empty graph std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"); diff --git a/example/degree_centrality.cpp b/example/degree_centrality.cpp index 1dbee79b..cd249bfa 100644 --- a/example/degree_centrality.cpp +++ b/example/degree_centrality.cpp @@ -24,19 +24,19 @@ struct Actor }; // Declare the graph type and its vertex and edge types. -typedef undirected_graph< Actor > Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = undirected_graph< Actor >; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; // The name map provides an abstract accessor for the names of // each vertex. This is used during graph creation. -typedef property_map< Graph, string Actor::* >::type NameMap; +using NameMap = property_map< Graph, string Actor::* >::type; // Declare a container type for degree centralities and its // corresponding property map. -typedef exterior_vertex_property< Graph, unsigned > CentralityProperty; -typedef CentralityProperty::container_type CentralityContainer; -typedef CentralityProperty::map_type CentralityMap; +using CentralityProperty = exterior_vertex_property< Graph, unsigned >; +using CentralityContainer = CentralityProperty::container_type; +using CentralityMap = CentralityProperty::map_type; int main(int argc, char* argv[]) { diff --git a/example/dfs-example.cpp b/example/dfs-example.cpp index fff17bfd..a508f556 100644 --- a/example/dfs-example.cpp +++ b/example/dfs-example.cpp @@ -16,7 +16,7 @@ using namespace boost; template < typename TimeMap > class dfs_time_visitor : public default_dfs_visitor { - typedef typename property_traits< TimeMap >::value_type T; + using T = typename property_traits< TimeMap >::value_type; public: dfs_time_visitor(TimeMap dmap, TimeMap fmap, T& t) @@ -41,8 +41,8 @@ public: int main() { // Select the graph type we wish to use - typedef adjacency_list< vecS, vecS, directedS > graph_t; - typedef graph_traits< graph_t >::vertices_size_type size_type; + using graph_t = adjacency_list< vecS, vecS, directedS >; + using size_type = graph_traits< graph_t >::vertices_size_type; // Set up the vertex names enum { @@ -56,7 +56,7 @@ int main() }; char name[] = { 'u', 'v', 'w', 'x', 'y', 'z' }; // Specify the edges in the graph - typedef std::pair< int, int > E; + using E = std::pair< int, int >; E edge_array[] = { E(u, v), E(u, x), E(x, v), E(y, x), E(v, y), E(w, y), E(w, z), E(z, z) }; #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 @@ -70,9 +70,9 @@ int main() // discover time and finish time properties std::vector< size_type > dtime(num_vertices(g)); std::vector< size_type > ftime(num_vertices(g)); - typedef iterator_property_map< std::vector< size_type >::iterator, - property_map< graph_t, vertex_index_t >::const_type > - time_pm_type; + using time_pm_type + = iterator_property_map< std::vector< size_type >::iterator, + property_map< graph_t, vertex_index_t >::const_type >; time_pm_type dtime_pm(dtime.begin(), get(vertex_index, g)); time_pm_type ftime_pm(ftime.begin(), get(vertex_index, g)); size_type t = 0; diff --git a/example/dfs.cpp b/example/dfs.cpp index b052a214..3594894f 100644 --- a/example/dfs.cpp +++ b/example/dfs.cpp @@ -52,7 +52,7 @@ using namespace std; template < class VisitorList > struct edge_categorizer : public dfs_visitor< VisitorList > { - typedef dfs_visitor< VisitorList > Base; + using Base = dfs_visitor< VisitorList >; edge_categorizer(const VisitorList& v = null_visitor()) : Base(v) {} @@ -93,7 +93,7 @@ int main(int, char*[]) using namespace boost; - typedef adjacency_list<> Graph; + using Graph = adjacency_list<>; Graph G(5); add_edge(0, 2, G); @@ -106,7 +106,7 @@ int main(int, char*[]) add_edge(4, 0, G); add_edge(4, 1, G); - typedef graph_traits< Graph >::vertices_size_type size_type; + using size_type = graph_traits< Graph >::vertices_size_type; std::vector< size_type > d(num_vertices(G)); std::vector< size_type > f(num_vertices(G)); diff --git a/example/dfs_parenthesis.cpp b/example/dfs_parenthesis.cpp index 6a421445..24539298 100644 --- a/example/dfs_parenthesis.cpp +++ b/example/dfs_parenthesis.cpp @@ -29,7 +29,7 @@ using namespace std; struct open_paren : public base_visitor< open_paren > { - typedef on_discover_vertex event_filter; + using event_filter = on_discover_vertex; template < class Vertex, class Graph > void operator()(Vertex v, Graph&) { std::cout << "(" << v; @@ -37,7 +37,7 @@ struct open_paren : public base_visitor< open_paren > }; struct close_paren : public base_visitor< close_paren > { - typedef on_finish_vertex event_filter; + using event_filter = on_finish_vertex; template < class Vertex, class Graph > void operator()(Vertex v, Graph&) { std::cout << v << ")"; @@ -49,8 +49,8 @@ int main(int, char*[]) using namespace boost; - typedef adjacency_list<> Graph; - typedef std::pair< int, int > E; + using Graph = adjacency_list<>; + using E = std::pair< int, int >; E edge_array[] = { E(0, 2), E(1, 1), E(1, 3), E(2, 1), E(2, 3), E(3, 1), E(3, 4), E(4, 0), E(4, 1) }; #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 diff --git a/example/dijkstra-example-listS.cpp b/example/dijkstra-example-listS.cpp index 4e975709..fefd6299 100644 --- a/example/dijkstra-example-listS.cpp +++ b/example/dijkstra-example-listS.cpp @@ -17,16 +17,15 @@ using namespace boost; int main(int, char*[]) { - typedef adjacency_list_traits< listS, listS, directedS >::vertex_descriptor - vertex_descriptor; - typedef adjacency_list< listS, listS, directedS, + using vertex_descriptor + = adjacency_list_traits< listS, listS, directedS >::vertex_descriptor; + using graph_t = adjacency_list< listS, listS, directedS, property< vertex_index_t, int, property< vertex_name_t, char, property< vertex_distance_t, int, property< vertex_predecessor_t, vertex_descriptor > > > >, - property< edge_weight_t, int > > - graph_t; - typedef std::pair< int, int > Edge; + property< edge_weight_t, int > >; + using Edge = std::pair< int, int >; const int num_nodes = 5; enum nodes diff --git a/example/dijkstra-example.cpp b/example/dijkstra-example.cpp index 1092ece8..e4517669 100644 --- a/example/dijkstra-example.cpp +++ b/example/dijkstra-example.cpp @@ -18,11 +18,10 @@ using namespace boost; int main(int, char*[]) { - typedef adjacency_list< listS, vecS, directedS, no_property, - property< edge_weight_t, int > > - graph_t; - typedef graph_traits< graph_t >::vertex_descriptor vertex_descriptor; - typedef std::pair< int, int > Edge; + using graph_t = adjacency_list< listS, vecS, directedS, no_property, + property< edge_weight_t, int > >; + using vertex_descriptor = graph_traits< graph_t >::vertex_descriptor; + using Edge = std::pair< int, int >; const int num_nodes = 5; enum nodes diff --git a/example/dijkstra-no-color-map-example.cpp b/example/dijkstra-no-color-map-example.cpp index 3d737b1a..97b01c81 100644 --- a/example/dijkstra-no-color-map-example.cpp +++ b/example/dijkstra-no-color-map-example.cpp @@ -22,11 +22,10 @@ using namespace boost; int main(int, char*[]) { - typedef adjacency_list< listS, vecS, directedS, no_property, - property< edge_weight_t, int > > - graph_t; - typedef graph_traits< graph_t >::vertex_descriptor vertex_descriptor; - typedef std::pair< int, int > Edge; + using graph_t = adjacency_list< listS, vecS, directedS, no_property, + property< edge_weight_t, int > >; + using vertex_descriptor = graph_traits< graph_t >::vertex_descriptor; + using Edge = std::pair< int, int >; const int num_nodes = 5; enum nodes diff --git a/example/directed_graph.cpp b/example/directed_graph.cpp index 41fe874e..90809d5b 100644 --- a/example/directed_graph.cpp +++ b/example/directed_graph.cpp @@ -16,7 +16,7 @@ int main(int, char*[]) // the code easier to understand. However, it hard codes many of the // template parameters, so it is much less flexible. - typedef boost::directed_graph<> Graph; + using Graph = boost::directed_graph<>; Graph g; auto v0 = g.add_vertex(); auto v1 = g.add_vertex(); diff --git a/example/eccentricity.cpp b/example/eccentricity.cpp index 58e43ace..8577ca2c 100644 --- a/example/eccentricity.cpp +++ b/example/eccentricity.cpp @@ -24,29 +24,29 @@ struct Actor }; // Declare the graph type and its vertex and edge types. -typedef undirected_graph< Actor > Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = undirected_graph< Actor >; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; // The name map provides an abstract accessor for the names of // each vertex. This is used during graph creation. -typedef property_map< Graph, string Actor::* >::type NameMap; +using NameMap = property_map< Graph, string Actor::* >::type; // Declare a matrix type and its corresponding property map that // will contain the distances between each pair of vertices. -typedef exterior_vertex_property< Graph, int > DistanceProperty; -typedef DistanceProperty::matrix_type DistanceMatrix; -typedef DistanceProperty::matrix_map_type DistanceMatrixMap; +using DistanceProperty = exterior_vertex_property< Graph, int >; +using DistanceMatrix = DistanceProperty::matrix_type; +using DistanceMatrixMap = DistanceProperty::matrix_map_type; // Declare the weight map so that each edge returns the same value. -typedef constant_property_map< Edge, int > WeightMap; +using WeightMap = constant_property_map< Edge, int >; // Declare a container and its corresponding property map that // will contain the resulting eccentricities of each vertex in // the graph. -typedef boost::exterior_vertex_property< Graph, int > EccentricityProperty; -typedef EccentricityProperty::container_type EccentricityContainer; -typedef EccentricityProperty::map_type EccentricityMap; +using EccentricityProperty = boost::exterior_vertex_property< Graph, int >; +using EccentricityContainer = EccentricityProperty::container_type; +using EccentricityMap = EccentricityProperty::map_type; int main(int argc, char* argv[]) { diff --git a/example/edge-connectivity.cpp b/example/edge-connectivity.cpp index 422013b1..a9bb1a33 100644 --- a/example/edge-connectivity.cpp +++ b/example/edge-connectivity.cpp @@ -29,7 +29,7 @@ std::pair< typename graph_traits< Graph >::vertex_descriptor, min_degree_vertex(Graph& g) { typename graph_traits< Graph >::vertex_descriptor p; - typedef typename graph_traits< Graph >::degree_size_type size_type; + using size_type = typename graph_traits< Graph >::degree_size_type; auto delta = (std::numeric_limits< size_type >::max)(); typename graph_traits< Graph >::vertex_iterator i, iend; for (boost::tie(i, iend) = vertices(g); i != iend; ++i) @@ -61,19 +61,17 @@ template < typename VertexListGraph, typename OutputIterator > typename graph_traits< VertexListGraph >::degree_size_type edge_connectivity( VertexListGraph& g, OutputIterator disconnecting_set) { - typedef typename graph_traits< VertexListGraph >::vertex_descriptor - vertex_descriptor; - typedef typename graph_traits< VertexListGraph >::degree_size_type - degree_size_type; - typedef color_traits< default_color_type > Color; - typedef - typename adjacency_list_traits< vecS, vecS, directedS >::edge_descriptor - edge_descriptor; - typedef adjacency_list< vecS, vecS, directedS, no_property, + using vertex_descriptor = + typename graph_traits< VertexListGraph >::vertex_descriptor; + using degree_size_type = + typename graph_traits< VertexListGraph >::degree_size_type; + using Color = color_traits< default_color_type >; + using edge_descriptor = typename adjacency_list_traits< vecS, vecS, + directedS >::edge_descriptor; + using FlowGraph = adjacency_list< vecS, vecS, directedS, no_property, property< edge_capacity_t, degree_size_type, property< edge_residual_capacity_t, degree_size_type, - property< edge_reverse_t, edge_descriptor > > > > - FlowGraph; + property< edge_reverse_t, edge_descriptor > > > >; vertex_descriptor u, v, p, k; edge_descriptor e1, e2; @@ -161,7 +159,7 @@ int main() GraphvizGraph g; read_graphviz("figs/edge-connectivity.dot", g); - typedef graph_traits< GraphvizGraph >::edge_descriptor edge_descriptor; + using edge_descriptor = graph_traits< GraphvizGraph >::edge_descriptor; std::vector< edge_descriptor > disconnecting_set; auto c = edge_connectivity(g, std::back_inserter(disconnecting_set)); diff --git a/example/edge-function.cpp b/example/edge-function.cpp index 2db1b7d0..31d2dd7c 100644 --- a/example/edge-function.cpp +++ b/example/edge-function.cpp @@ -17,7 +17,7 @@ template < typename Graph, typename VertexNamePropertyMap > void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g, VertexNamePropertyMap name_map) { - typedef typename graph_traits< Graph >::vertices_size_type size_type; + using size_type = typename graph_traits< Graph >::vertices_size_type; size_type n_vertices; typename graph_traits< Graph >::vertex_descriptor u; typename property_traits< VertexNamePropertyMap >::value_type name; @@ -76,13 +76,12 @@ inline name_equals_t< NameMap > name_equals( int main(int argc, const char** argv) { - typedef adjacency_list< listS, // Store out-edges of each vertex in a - // std::list + using graph_type = adjacency_list< listS, // Store out-edges of each vertex + // in a std::list vecS, // Store vertex set in a std::vector directedS, // The graph is directed property< vertex_name_t, std::string > // Add a vertex property - > - graph_type; + >; graph_type g; // use default constructor to create empty graph const char* dep_file_name diff --git a/example/edge-iter-constructor.cpp b/example/edge-iter-constructor.cpp index 84eb6c2d..c8abe2e9 100644 --- a/example/edge-iter-constructor.cpp +++ b/example/edge-iter-constructor.cpp @@ -21,15 +21,14 @@ std::istream& operator>>(std::istream& in, std::pair< T, T >& p) int main(int argc, const char** argv) { - typedef adjacency_list< listS, // Store out-edges of each vertex in a - // std::list + using graph_type = adjacency_list< listS, // Store out-edges of each vertex + // in a std::list vecS, // Store vertex set in a std::vector directedS // The graph is directed - > - graph_type; + >; std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"); - typedef graph_traits< graph_type >::vertices_size_type size_type; + using size_type = graph_traits< graph_type >::vertices_size_type; size_type n_vertices; file_in >> n_vertices; // read in number of vertices diff --git a/example/edge_basics.cpp b/example/edge_basics.cpp index fac23197..3b88d852 100644 --- a/example/edge_basics.cpp +++ b/example/edge_basics.cpp @@ -40,8 +40,8 @@ template < class Graph > struct exercise_edge { exercise_edge(Graph& g) : G(g) {} - typedef typename boost::graph_traits< Graph >::edge_descriptor Edge; - typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex; + using Edge = typename boost::graph_traits< Graph >::edge_descriptor; + using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor; void operator()(Edge e) const { // begin @@ -62,9 +62,9 @@ template < class Graph > struct exercise_edge int main() { - typedef adjacency_list<> MyGraph; + using MyGraph = adjacency_list<>; - typedef pair< int, int > Pair; + using Pair = pair< int, int >; Pair edge_array[8] = { Pair(0, 1), Pair(0, 2), Pair(0, 3), Pair(0, 4), Pair(2, 0), Pair(3, 0), Pair(2, 4), Pair(3, 1) }; diff --git a/example/edge_coloring.cpp b/example/edge_coloring.cpp index 402337df..41a79648 100644 --- a/example/edge_coloring.cpp +++ b/example/edge_coloring.cpp @@ -36,11 +36,10 @@ int main(int, char*[]) { using namespace boost; using namespace std; - typedef adjacency_list< vecS, vecS, undirectedS, no_property, size_t, - no_property > - Graph; + using Graph = adjacency_list< vecS, vecS, undirectedS, no_property, size_t, + no_property >; - typedef std::pair< std::size_t, std::size_t > Pair; + using Pair = std::pair< std::size_t, std::size_t >; Pair edges[14] = { Pair(0, 3), // a-d Pair(0, 5), // a-f Pair(1, 2), // b-c diff --git a/example/edge_connectivity.cpp b/example/edge_connectivity.cpp index e273a3d3..cf30a361 100644 --- a/example/edge_connectivity.cpp +++ b/example/edge_connectivity.cpp @@ -27,7 +27,7 @@ using namespace boost; int main() { const int N = 8; - typedef adjacency_list< vecS, vecS, undirectedS > UndirectedGraph; + using UndirectedGraph = adjacency_list< vecS, vecS, undirectedS >; UndirectedGraph g(N); add_edge(0, 1, g); @@ -45,8 +45,8 @@ int main() add_edge(5, 7, g); add_edge(6, 7, g); - typedef graph_traits< UndirectedGraph >::edge_descriptor edge_descriptor; - typedef graph_traits< UndirectedGraph >::degree_size_type degree_size_type; + using edge_descriptor = graph_traits< UndirectedGraph >::edge_descriptor; + using degree_size_type = graph_traits< UndirectedGraph >::degree_size_type; std::vector< edge_descriptor > disconnecting_set; auto c = edge_connectivity(g, std::back_inserter(disconnecting_set)); diff --git a/example/edge_iterator_constructor.cpp b/example/edge_iterator_constructor.cpp index 6c2c6f72..96f0d4d9 100644 --- a/example/edge_iterator_constructor.cpp +++ b/example/edge_iterator_constructor.cpp @@ -44,11 +44,11 @@ class edge_stream_iterator { public: - typedef std::input_iterator_tag iterator_category; - typedef std::pair< int, int > value_type; - typedef std::ptrdiff_t difference_type; - typedef const value_type* pointer; - typedef const value_type& reference; + using iterator_category = std::input_iterator_tag; + using value_type = std::pair< int, int >; + using difference_type = std::ptrdiff_t; + using pointer = const value_type*; + using reference = const value_type&; edge_stream_iterator() : m_stream(0), m_end_marker(false) {} edge_stream_iterator(std::istream& s) : m_stream(&s) { m_read(); } @@ -93,8 +93,8 @@ bool operator!=(const edge_stream_iterator& x, const edge_stream_iterator& y) int main(int argc, const char** argv) { - typedef boost::adjacency_list<> IteratorConstructibleGraph; - typedef boost::graph_traits< IteratorConstructibleGraph > Traits; + using IteratorConstructibleGraph = boost::adjacency_list<>; + using Traits = boost::graph_traits< IteratorConstructibleGraph >; Traits::vertices_size_type size_V; Traits::edges_size_type size_E; diff --git a/example/edge_property.cpp b/example/edge_property.cpp index 9fe2272d..6941e825 100644 --- a/example/edge_property.cpp +++ b/example/edge_property.cpp @@ -75,10 +75,10 @@ BOOST_INSTALL_PROPERTY(edge, mycapacity); template < class Graph > void print_network(const Graph& G) { - typedef typename boost::graph_traits< Graph >::vertex_iterator Viter; - typedef - typename boost::graph_traits< Graph >::out_edge_iterator OutEdgeIter; - typedef typename boost::graph_traits< Graph >::in_edge_iterator InEdgeIter; + using Viter = typename boost::graph_traits< Graph >::vertex_iterator; + using OutEdgeIter = + typename boost::graph_traits< Graph >::out_edge_iterator; + using InEdgeIter = typename boost::graph_traits< Graph >::in_edge_iterator; auto capacity = get(edge_mycapacity, G); auto flow = get(edge_myflow, G); @@ -109,10 +109,10 @@ template < class Graph > void print_network(const Graph& G) int main(int, char*[]) { - typedef property< edge_mycapacity_t, int > Cap; - typedef property< edge_myflow_t, int, Cap > Flow; - typedef adjacency_list< vecS, vecS, bidirectionalS, no_property, Flow > - Graph; + using Cap = property< edge_mycapacity_t, int >; + using Flow = property< edge_myflow_t, int, Cap >; + using Graph + = adjacency_list< vecS, vecS, bidirectionalS, no_property, Flow >; const int num_vertices = 9; Graph G(num_vertices); diff --git a/example/edmonds-karp-eg.cpp b/example/edmonds-karp-eg.cpp index a07bde38..e61c5292 100644 --- a/example/edmonds-karp-eg.cpp +++ b/example/edmonds-karp-eg.cpp @@ -51,13 +51,12 @@ int main() { using namespace boost; - typedef adjacency_list_traits< vecS, vecS, directedS > Traits; - typedef adjacency_list< listS, vecS, directedS, + using Traits = adjacency_list_traits< vecS, vecS, directedS >; + using Graph = adjacency_list< listS, vecS, directedS, property< vertex_name_t, std::string >, property< edge_capacity_t, long, property< edge_residual_capacity_t, long, - property< edge_reverse_t, Traits::edge_descriptor > > > > - Graph; + property< edge_reverse_t, Traits::edge_descriptor > > > >; Graph g; diff --git a/example/exterior_properties.cpp b/example/exterior_properties.cpp index 4c2e892f..7d0a99b6 100644 --- a/example/exterior_properties.cpp +++ b/example/exterior_properties.cpp @@ -40,10 +40,10 @@ template < class Graph, class Capacity, class Flow > void print_network(Graph& G, Capacity capacity, Flow flow) { - typedef typename boost::graph_traits< Graph >::vertex_iterator Viter; - typedef - typename boost::graph_traits< Graph >::out_edge_iterator OutEdgeIter; - typedef typename boost::graph_traits< Graph >::in_edge_iterator InEdgeIter; + using Viter = typename boost::graph_traits< Graph >::vertex_iterator; + using OutEdgeIter = + typename boost::graph_traits< Graph >::out_edge_iterator; + using InEdgeIter = typename boost::graph_traits< Graph >::in_edge_iterator; Viter ui, uiend; for (boost::tie(ui, uiend) = boost::vertices(G); ui != uiend; ++ui) @@ -71,10 +71,9 @@ void print_network(Graph& G, Capacity capacity, Flow flow) int main(int, char*[]) { - typedef boost::adjacency_list< boost::vecS, boost::vecS, + using Graph = boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, boost::no_property, - boost::property< boost::edge_index_t, std::size_t > > - Graph; + boost::property< boost::edge_index_t, std::size_t > >; const int num_vertices = 9; Graph G(num_vertices); @@ -110,12 +109,12 @@ int main(int, char*[]) boost::add_edge(6, 8, 9, G); - typedef boost::property_map< Graph, boost::edge_index_t >::type - EdgeIndexMap; + using EdgeIndexMap + = boost::property_map< Graph, boost::edge_index_t >::type; EdgeIndexMap edge_id = boost::get(boost::edge_index, G); - typedef boost::iterator_property_map< int*, EdgeIndexMap, int, int& > - IterMap; + using IterMap + = boost::iterator_property_map< int*, EdgeIndexMap, int, int& >; print_network(G, IterMap(capacity, edge_id), IterMap(flow, edge_id)); diff --git a/example/exterior_property_map.cpp b/example/exterior_property_map.cpp index 8aa40475..92945148 100644 --- a/example/exterior_property_map.cpp +++ b/example/exterior_property_map.cpp @@ -76,9 +76,9 @@ int main(int, char*[]) names[3] = "Jeff"; names[4] = "Kinis"; - typedef adjacency_list<> MyGraphType; + using MyGraphType = adjacency_list<>; - typedef pair< int, int > Pair; + using Pair = pair< int, int >; Pair edge_array[11] = { Pair(0, 1), Pair(0, 2), Pair(0, 3), Pair(0, 4), Pair(2, 0), Pair(3, 0), Pair(2, 4), Pair(3, 1), Pair(3, 4), Pair(4, 0), Pair(4, 1) }; diff --git a/example/fibonacci_heap.cpp b/example/fibonacci_heap.cpp index ca70367d..b602c1ad 100644 --- a/example/fibonacci_heap.cpp +++ b/example/fibonacci_heap.cpp @@ -26,7 +26,7 @@ using namespace boost; int main() { - typedef indirect_cmp< float*, std::less< float > > ICmp; + using ICmp = indirect_cmp< float*, std::less< float > >; int i; random_ns::mt19937 gen; for (int N = 2; N < 200; ++N) diff --git a/example/file_dependencies.cpp b/example/file_dependencies.cpp index d4344b98..e8f88248 100644 --- a/example/file_dependencies.cpp +++ b/example/file_dependencies.cpp @@ -92,7 +92,7 @@ protected: int main(int, char*[]) { - typedef pair< int, int > Edge; + using Edge = pair< int, int >; Edge used_by[] = { Edge(dax_h, foo_cpp), Edge(dax_h, bar_cpp), Edge(dax_h, yow_h), Edge(yow_h, bar_cpp), Edge(yow_h, zag_cpp), Edge(boz_h, bar_cpp), Edge(boz_h, zig_cpp), Edge(boz_h, zag_cpp), @@ -103,7 +103,7 @@ int main(int, char*[]) Edge(zag_o, libzigzag_a), Edge(libzigzag_a, killerapp) }; const std::size_t nedges = sizeof(used_by) / sizeof(Edge); - typedef adjacency_list< vecS, vecS, bidirectionalS > Graph; + using Graph = adjacency_list< vecS, vecS, bidirectionalS >; #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // VC++ can't handle the iterator constructor Graph g(N); @@ -117,12 +117,12 @@ int main(int, char*[]) #else Graph g(used_by, used_by + nedges, N); #endif - typedef graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = graph_traits< Graph >::vertex_descriptor; // Determine ordering for a full recompilation // and the order with files that can be compiled in parallel { - typedef list< Vertex > MakeOrder; + using MakeOrder = list< Vertex >; MakeOrder::iterator i; MakeOrder make_order; diff --git a/example/filtered-copy-example.cpp b/example/filtered-copy-example.cpp index 19490c55..e5cc472d 100644 --- a/example/filtered-copy-example.cpp +++ b/example/filtered-copy-example.cpp @@ -29,9 +29,8 @@ template < typename Graph > struct non_zero_degree int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, bidirectionalS, - property< vertex_name_t, char > > - graph_t; + using graph_t = adjacency_list< vecS, vecS, bidirectionalS, + property< vertex_name_t, char > >; enum { @@ -51,7 +50,7 @@ int main() for (boost::tie(v, v_end) = vertices(G); v != v_end; ++v, ++name) name_map[*v] = name; - typedef std::pair< int, int > E; + using E = std::pair< int, int >; E edges[] = { E(a, c), E(a, d), E(b, a), E(b, d), E(c, f), E(d, c), E(d, e), E(d, f), E(e, b), E(e, g), E(f, e), E(f, g) }; for (int i = 0; i < 12; ++i) diff --git a/example/filtered_graph.cpp b/example/filtered_graph.cpp index 9a89718c..88a52076 100644 --- a/example/filtered_graph.cpp +++ b/example/filtered_graph.cpp @@ -40,10 +40,9 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, directedS, no_property, - property< edge_weight_t, int > > - Graph; - typedef property_map< Graph, edge_weight_t >::type EdgeWeightMap; + using Graph = adjacency_list< vecS, vecS, directedS, no_property, + property< edge_weight_t, int > >; + using EdgeWeightMap = property_map< Graph, edge_weight_t >::type; enum { diff --git a/example/filtered_graph_edge_range.cpp b/example/filtered_graph_edge_range.cpp index 77598082..8d289b02 100644 --- a/example/filtered_graph_edge_range.cpp +++ b/example/filtered_graph_edge_range.cpp @@ -40,10 +40,9 @@ int main() { using namespace boost; - typedef adjacency_list< multisetS, vecS, directedS, no_property, - property< edge_weight_t, int > > - Graph; - typedef property_map< Graph, edge_weight_t >::type EdgeWeightMap; + using Graph = adjacency_list< multisetS, vecS, directedS, no_property, + property< edge_weight_t, int > >; + using EdgeWeightMap = property_map< Graph, edge_weight_t >::type; enum { @@ -74,8 +73,8 @@ int main() << name[target(*f, g)] << "\n"; positive_edge_weight< EdgeWeightMap > filter(weight); - typedef filtered_graph< Graph, positive_edge_weight< EdgeWeightMap > > - FGraph; + using FGraph + = filtered_graph< Graph, positive_edge_weight< EdgeWeightMap > >; FGraph fg(g, filter); std::cout << "filtered edge_range(C,D)\n"; diff --git a/example/filtered_vec_as_graph.cpp b/example/filtered_vec_as_graph.cpp index d6cc52cf..d749f411 100644 --- a/example/filtered_vec_as_graph.cpp +++ b/example/filtered_vec_as_graph.cpp @@ -48,7 +48,7 @@ int main() E }; const char* name = "ABCDE"; - typedef std::vector< std::list< int > > Graph; + using Graph = std::vector< std::list< int > >; Graph g = { { B, C }, // A {}, // B { D, E }, // C diff --git a/example/fr_layout.cpp b/example/fr_layout.cpp index ea49708e..96a783d7 100644 --- a/example/fr_layout.cpp +++ b/example/fr_layout.cpp @@ -41,16 +41,15 @@ void usage() "vertex on each line, separated by spaces.\n"; } -typedef boost::rectangle_topology<> topology_type; -typedef topology_type::point_type point_type; +using topology_type = boost::rectangle_topology<>; +using point_type = topology_type::point_type; -typedef adjacency_list< listS, vecS, undirectedS, - property< vertex_name_t, std::string > > - Graph; +using Graph = adjacency_list< listS, vecS, undirectedS, + property< vertex_name_t, std::string > >; -typedef graph_traits< Graph >::vertex_descriptor Vertex; +using Vertex = graph_traits< Graph >::vertex_descriptor; -typedef std::map< std::string, Vertex > NameToVertex; +using NameToVertex = std::map< std::string, Vertex >; Vertex get_vertex(const std::string& name, Graph& g, NameToVertex& names) { @@ -62,7 +61,7 @@ Vertex get_vertex(const std::string& name, Graph& g, NameToVertex& names) class progress_cooling : public linear_cooling< double > { - typedef linear_cooling< double > inherited; + using inherited = linear_cooling< double >; public: explicit progress_cooling(std::size_t iterations) : inherited(iterations) @@ -135,11 +134,10 @@ int main(int argc, char* argv[]) add_edge(get_vertex(source, g, names), get_vertex(target, g, names), g); } - typedef std::vector< point_type > PositionVec; + using PositionVec = std::vector< point_type >; PositionVec position_vec(num_vertices(g)); - typedef iterator_property_map< PositionVec::iterator, - property_map< Graph, vertex_index_t >::type > - PositionMap; + using PositionMap = iterator_property_map< PositionVec::iterator, + property_map< Graph, vertex_index_t >::type >; PositionMap position(position_vec.begin(), get(vertex_index, g)); minstd_rand gen; diff --git a/example/gerdemann.cpp b/example/gerdemann.cpp index 9058435c..9f815d0f 100644 --- a/example/gerdemann.cpp +++ b/example/gerdemann.cpp @@ -42,7 +42,7 @@ void merge_vertex(typename boost::graph_traits< Graph >::vertex_descriptor u, typename boost::graph_traits< Graph >::vertex_descriptor v, Graph& g, GetEdgeProperties getp) { - typedef boost::graph_traits< Graph > Traits; + using Traits = boost::graph_traits< Graph >; typename Traits::edge_descriptor e; typename Traits::out_edge_iterator out_i, out_end; for (boost::tie(out_i, out_end) = out_edges(v, g); out_i != out_end; @@ -65,9 +65,9 @@ void merge_vertex(typename boost::graph_traits< Graph >::vertex_descriptor u, template < class StoredEdge > struct order_by_name { - typedef StoredEdge first_argument_type; - typedef StoredEdge second_argument_type; - typedef bool result_type; + using first_argument_type = StoredEdge; + using second_argument_type = StoredEdge; + using result_type = bool; bool operator()(const StoredEdge& e1, const StoredEdge& e2) const { // Using std::pair operator< as an easy way to get lexicographical @@ -86,11 +86,11 @@ namespace boost template < class ValueType > struct container_gen< ordered_set_by_nameS, ValueType > { - typedef std::set< ValueType, order_by_name< ValueType > > type; + using type = std::set< ValueType, order_by_name< ValueType > >; }; template <> struct parallel_edge_traits< ordered_set_by_nameS > { - typedef allow_parallel_edge_tag type; + using type = allow_parallel_edge_tag; }; } #endif @@ -114,10 +114,9 @@ int main() std::cout << "This program requires partial specialization." << std::endl; #else using namespace boost; - typedef property< edge_name_t, char > EdgeProperty; - typedef adjacency_list< ordered_set_by_nameS, vecS, bidirectionalS, - no_property, EdgeProperty > - graph_type; + using EdgeProperty = property< edge_name_t, char >; + using graph_type = adjacency_list< ordered_set_by_nameS, vecS, + bidirectionalS, no_property, EdgeProperty >; graph_type g; diff --git a/example/girth.cpp b/example/girth.cpp index a55aae2a..0a031e1e 100644 --- a/example/girth.cpp +++ b/example/girth.cpp @@ -49,20 +49,20 @@ #include #include -typedef boost::graph_traits< Graph* > Traits; -typedef Traits::vertex_descriptor vertex_descriptor; -typedef Traits::edge_descriptor edge_descriptor; -typedef Traits::vertex_iterator vertex_iterator; +using Traits = boost::graph_traits< Graph* >; +using vertex_descriptor = Traits::vertex_descriptor; +using edge_descriptor = Traits::edge_descriptor; +using vertex_iterator = Traits::vertex_iterator; std::vector< std::size_t > distance_list; -typedef boost::v_property< long > dist_t; +using dist_t = boost::v_property< long >; boost::property_map< Graph*, dist_t >::type d_map; -typedef boost::u_property< vertex_descriptor > pred_t; +using pred_t = boost::u_property< vertex_descriptor >; boost::property_map< Graph*, pred_t >::type p_map; -typedef boost::w_property< long > color_t; +using color_t = boost::w_property< long >; boost::property_map< Graph*, color_t >::type c_map; class diameter_and_girth_visitor : public boost::bfs_visitor<> diff --git a/example/graph-assoc-types.cpp b/example/graph-assoc-types.cpp index 5af9a8cc..03cb8791 100644 --- a/example/graph-assoc-types.cpp +++ b/example/graph-assoc-types.cpp @@ -13,11 +13,11 @@ using namespace boost; template < typename Graph > void generic_foo(Graph& g) { // Access descriptor types - typedef typename graph_traits< Graph >::vertex_descriptor Vertex; - typedef typename graph_traits< Graph >::edge_descriptor Edge; + using Vertex = typename graph_traits< Graph >::vertex_descriptor; + using Edge = typename graph_traits< Graph >::edge_descriptor; // Access category types - typedef typename graph_traits< Graph >::directed_category Dir; - typedef typename graph_traits< Graph >::edge_parallel_category Par; + using Dir = typename graph_traits< Graph >::directed_category; + using Par = typename graph_traits< Graph >::edge_parallel_category; // Access iterator types... // Access size types... // Now do something useful... @@ -52,7 +52,7 @@ template < typename Graph > void foo_dispatch(Graph& g, boost::undirected_tag) template < typename Graph > void foo(Graph& g) { - typedef typename boost::graph_traits< Graph >::directed_category Cat; + using Cat = typename boost::graph_traits< Graph >::directed_category; foo_dispatch(g, Cat()); } @@ -61,7 +61,7 @@ void foo(Digraph& digraph, typename graph_traits< Digraph >::vertex_descriptor u, typename graph_traits< Digraph >::vertex_descriptor v) { - typedef typename graph_traits< Digraph >::edge_descriptor edge_t; + using edge_t = typename graph_traits< Digraph >::edge_descriptor; std::pair< edge_t, bool > e1, e2; e1 = edge(u, v, digraph); e2 = edge(v, u, digraph); @@ -72,7 +72,7 @@ void bar(Undigraph& undigraph, typename graph_traits< Undigraph >::vertex_descriptor u, typename graph_traits< Undigraph >::vertex_descriptor v) { - typedef typename graph_traits< Undigraph >::edge_descriptor edge_t; + using edge_t = typename graph_traits< Undigraph >::edge_descriptor; std::pair< edge_t, bool > e1, e2; e1 = edge(u, v, undigraph); e2 = edge(v, u, undigraph); diff --git a/example/graph-property-iter-eg.cpp b/example/graph-property-iter-eg.cpp index 27ac96d4..9b5986ca 100644 --- a/example/graph-property-iter-eg.cpp +++ b/example/graph-property-iter-eg.cpp @@ -15,9 +15,8 @@ int main() { using namespace boost; - typedef adjacency_list< listS, vecS, directedS, - property< vertex_name_t, std::string > > - graph_t; + using graph_t = adjacency_list< listS, vecS, directedS, + property< vertex_name_t, std::string > >; graph_t g(3); const char* vertex_names[] = { "Kubrick", "Clark", "Hal" }; diff --git a/example/graph-thingie.cpp b/example/graph-thingie.cpp index eaa5dc82..71eaa780 100644 --- a/example/graph-thingie.cpp +++ b/example/graph-thingie.cpp @@ -24,29 +24,27 @@ using namespace std; // (see the documentation for adjacency list) struct graph_identifier_t { - typedef graph_property_tag kind; + using kind = graph_property_tag; }; struct vertex_label_t { - typedef vertex_property_tag kind; + using kind = vertex_property_tag; }; int main() { // Vertex properties - typedef property< vertex_name_t, string, - property< vertex_label_t, string, property< vertex_root_t, int > > > - vertex_p; + using vertex_p = property< vertex_name_t, string, + property< vertex_label_t, string, property< vertex_root_t, int > > >; // Edge properties - typedef property< edge_name_t, string > edge_p; + using edge_p = property< edge_name_t, string >; // Graph properties - typedef property< graph_name_t, string, - property< graph_identifier_t, string > > - graph_p; + using graph_p = property< graph_name_t, string, + property< graph_identifier_t, string > >; // adjacency_list-based type - typedef adjacency_list< vecS, vecS, directedS, vertex_p, edge_p, graph_p > - graph_t; + using graph_t + = adjacency_list< vecS, vecS, directedS, vertex_p, edge_p, graph_p >; // Construct an empty graph and prepare the dynamic_property_maps. graph_t graph(0); diff --git a/example/graph.cpp b/example/graph.cpp index ee2de06c..83d30ec8 100644 --- a/example/graph.cpp +++ b/example/graph.cpp @@ -17,16 +17,14 @@ using namespace boost; using namespace std; -typedef property< vertex_color_t, default_color_type, +using VertexProperty = property< vertex_color_t, default_color_type, property< vertex_distance_t, int, property< vertex_degree_t, int, property< vertex_in_degree_t, int, - property< vertex_out_degree_t, int > > > > > - VertexProperty; -typedef property< edge_weight_t, int > EdgeProperty; -typedef adjacency_list< vecS, vecS, bidirectionalS, VertexProperty, - EdgeProperty > - Graph; + property< vertex_out_degree_t, int > > > > >; +using EdgeProperty = property< edge_weight_t, int >; +using Graph = adjacency_list< vecS, vecS, bidirectionalS, VertexProperty, + EdgeProperty >; template < class Graph > void print(Graph& g) { diff --git a/example/graph_as_tree.cpp b/example/graph_as_tree.cpp index 4fa08eff..46d770e8 100644 --- a/example/graph_as_tree.cpp +++ b/example/graph_as_tree.cpp @@ -32,10 +32,9 @@ public: int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, directedS, - property< vertex_name_t, std::string > > - graph_t; - typedef graph_traits< graph_t >::vertex_descriptor vertex_t; + using graph_t = adjacency_list< vecS, vecS, directedS, + property< vertex_name_t, std::string > >; + using vertex_t = graph_traits< graph_t >::vertex_descriptor; graph_t g; @@ -49,11 +48,11 @@ int main() name[b] = "B"; name[c] = "C"; - typedef iterator_property_map< std::vector< vertex_t >::iterator, - property_map< graph_t, vertex_index_t >::type > - parent_map_t; + using parent_map_t + = iterator_property_map< std::vector< vertex_t >::iterator, + property_map< graph_t, vertex_index_t >::type >; std::vector< vertex_t > parent(num_vertices(g)); - typedef graph_as_tree< graph_t, parent_map_t > tree_t; + using tree_t = graph_as_tree< graph_t, parent_map_t >; tree_t t( g, a, make_iterator_property_map(parent.begin(), get(vertex_index, g))); diff --git a/example/graph_property.cpp b/example/graph_property.cpp index eec0ed2f..fcf0160d 100644 --- a/example/graph_property.cpp +++ b/example/graph_property.cpp @@ -14,16 +14,15 @@ int main() using namespace boost; using std::string; - typedef adjacency_list< vecS, vecS, directedS, no_property, - property< edge_index_t, int >, property< graph_name_t, string > > - graph_t; + using graph_t = adjacency_list< vecS, vecS, directedS, no_property, + property< edge_index_t, int >, property< graph_name_t, string > >; graph_t g; get_property(g, graph_name) = "graph"; std::cout << "name: " << get_property(g, graph_name) << std::endl; - typedef subgraph< graph_t > subgraph_t; + using subgraph_t = subgraph< graph_t >; subgraph_t sg; get_property(sg, graph_name) = "subgraph"; diff --git a/example/graphviz.cpp b/example/graphviz.cpp index 5c652897..d0ba491f 100644 --- a/example/graphviz.cpp +++ b/example/graphviz.cpp @@ -14,13 +14,11 @@ using namespace boost; -typedef boost::adjacency_list< vecS, vecS, directedS, - property< vertex_name_t, std::string >, property< edge_weight_t, double > > - Digraph; +using Digraph = boost::adjacency_list< vecS, vecS, directedS, + property< vertex_name_t, std::string >, property< edge_weight_t, double > >; -typedef boost::adjacency_list< vecS, vecS, undirectedS, - property< vertex_name_t, std::string >, property< edge_weight_t, double > > - Graph; +using Graph = boost::adjacency_list< vecS, vecS, undirectedS, + property< vertex_name_t, std::string >, property< edge_weight_t, double > >; void test_graph_read_write(const std::string& filename) { @@ -38,7 +36,7 @@ void test_graph_read_write(const std::string& filename) BOOST_TEST(num_vertices(g) == 4); BOOST_TEST(num_edges(g) == 4); - typedef graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = graph_traits< Graph >::vertex_descriptor; std::map< std::string, Vertex > name_to_vertex; BGL_FORALL_VERTICES(v, g, Graph) diff --git a/example/grid_graph_example.cpp b/example/grid_graph_example.cpp index c49a3b16..bd3c251b 100644 --- a/example/grid_graph_example.cpp +++ b/example/grid_graph_example.cpp @@ -14,8 +14,8 @@ #define DIMENSIONS 3 using namespace boost; -typedef grid_graph< DIMENSIONS > Graph; -typedef graph_traits< Graph > Traits; +using Graph = grid_graph< DIMENSIONS >; +using Traits = graph_traits< Graph >; // Define a simple function to print vertices void print_vertex(Traits::vertex_descriptor vertex_to_print) diff --git a/example/grid_graph_properties.cpp b/example/grid_graph_properties.cpp index e09afc95..a41968e5 100644 --- a/example/grid_graph_properties.cpp +++ b/example/grid_graph_properties.cpp @@ -14,7 +14,7 @@ int main(int argc, char* argv[]) { // A 2D grid graph - typedef boost::grid_graph< 2 > GraphType; + using GraphType = boost::grid_graph< 2 >; // Create a 5x5 graph const unsigned int dimension = 5; @@ -22,8 +22,8 @@ int main(int argc, char* argv[]) GraphType graph(lengths); // Get the index map of the grid graph - typedef boost::property_map< GraphType, boost::vertex_index_t >::const_type - indexMapType; + using indexMapType + = boost::property_map< GraphType, boost::vertex_index_t >::const_type; indexMapType indexMap(get(boost::vertex_index, graph)); // Create a float for every node in the graph diff --git a/example/hawick_circuits.cpp b/example/hawick_circuits.cpp index 54346e5e..c79e402b 100644 --- a/example/hawick_circuits.cpp +++ b/example/hawick_circuits.cpp @@ -47,8 +47,8 @@ template < typename Graph, typename VertexPairIterator > void build_graph(Graph& graph, unsigned int const nvertices, VertexPairIterator first, VertexPairIterator last) { - typedef boost::graph_traits< Graph > Traits; - typedef typename Traits::vertex_descriptor vertex_descriptor; + using Traits = boost::graph_traits< Graph >; + using vertex_descriptor = typename Traits::vertex_descriptor; std::map< unsigned int, vertex_descriptor > vertices; for (unsigned int i = 0; i < nvertices; ++i) diff --git a/example/helper.hpp b/example/helper.hpp index 571fb724..44b1e4f8 100644 --- a/example/helper.hpp +++ b/example/helper.hpp @@ -18,8 +18,8 @@ template < typename Graph, typename NameMap, typename VertexMap > typename boost::graph_traits< Graph >::vertex_descriptor add_named_vertex( Graph& g, NameMap nm, const std::string& name, VertexMap& vm) { - typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex; - typedef typename VertexMap::iterator Iterator; + using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor; + using Iterator = typename VertexMap::iterator; Vertex v; Iterator iter; @@ -46,7 +46,7 @@ inline std::map< std::string, typename boost::graph_traits< Graph >::vertex_descriptor > read_graph(Graph& g, NameMap nm, InputStream& is) { - typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor; std::map< std::string, Vertex > verts; for (std::string line; std::getline(is, line);) { @@ -68,8 +68,8 @@ inline std::map< std::string, typename boost::graph_traits< Graph >::vertex_descriptor > read_graph(Graph& g, InputStream& is) { - typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex; - typedef boost::null_property_map< Vertex, std::string > NameMap; + using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor; + using NameMap = boost::null_property_map< Vertex, std::string >; return read_graph(g, NameMap(), is); } @@ -79,8 +79,8 @@ inline std::map< std::string, typename boost::graph_traits< Graph >::vertex_descriptor > read_weighted_graph(Graph& g, NameMap nm, WeightMap wm, InputStream& is) { - typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex; - typedef typename boost::graph_traits< Graph >::edge_descriptor Edge; + using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor; + using Edge = typename boost::graph_traits< Graph >::edge_descriptor; std::map< std::string, Vertex > verts; for (std::string line; std::getline(is, line);) { @@ -113,8 +113,8 @@ inline std::map< std::string, typename boost::graph_traits< Graph >::vertex_descriptor > read_weighted_graph(Graph& g, WeightMap wm, InputStream& is) { - typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex; - typedef boost::null_property_map< Vertex, std::string > NameMap; + using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor; + using NameMap = boost::null_property_map< Vertex, std::string >; return read_weighted_graph(g, NameMap(), wm, is); } diff --git a/example/implicit_graph.cpp b/example/implicit_graph.cpp index 7793cb55..fad2e249 100644 --- a/example/implicit_graph.cpp +++ b/example/implicit_graph.cpp @@ -92,14 +92,14 @@ namespace boost { template <> struct property_map< ring_graph, edge_weight_t > { - typedef edge_weight_map type; - typedef edge_weight_map const_type; + using type = edge_weight_map; + using const_type = edge_weight_map; }; template <> struct property_map< const ring_graph, edge_weight_t > { - typedef edge_weight_map type; - typedef edge_weight_map const_type; + using type = edge_weight_map; + using const_type = edge_weight_map; }; } @@ -121,35 +121,35 @@ class ring_graph { public: // Graph associated types - typedef std::size_t vertex_descriptor; - typedef boost::undirected_tag directed_category; - typedef boost::disallow_parallel_edge_tag edge_parallel_category; - typedef ring_traversal_catetory traversal_category; + using vertex_descriptor = std::size_t; + using directed_category = boost::undirected_tag; + using edge_parallel_category = boost::disallow_parallel_edge_tag; + using traversal_category = ring_traversal_catetory; // IncidenceGraph associated types - typedef std::pair< vertex_descriptor, vertex_descriptor > edge_descriptor; - typedef ring_incident_edge_iterator out_edge_iterator; - typedef std::size_t degree_size_type; + using edge_descriptor = std::pair< vertex_descriptor, vertex_descriptor >; + using out_edge_iterator = ring_incident_edge_iterator; + using degree_size_type = std::size_t; // BidirectionalGraph associated types // Note that undirected graphs make no distinction between in- and out- // edges. - typedef ring_incident_edge_iterator in_edge_iterator; + using in_edge_iterator = ring_incident_edge_iterator; // AdjacencyGraph associated types - typedef ring_adjacency_iterator adjacency_iterator; + using adjacency_iterator = ring_adjacency_iterator; // VertexListGraph associated types - typedef boost::counting_iterator< vertex_descriptor > vertex_iterator; - typedef std::size_t vertices_size_type; + using vertex_iterator = boost::counting_iterator< vertex_descriptor >; + using vertices_size_type = std::size_t; // EdgeListGraph associated types - typedef ring_edge_iterator edge_iterator; - typedef std::size_t edges_size_type; + using edge_iterator = ring_edge_iterator; + using edges_size_type = std::size_t; // This type is not part of a graph concept, but is used to return the // default vertex index map used by the Dijkstra search algorithm. - typedef vertex_descriptor vertex_property_type; + using vertex_property_type = vertex_descriptor; ring_graph(std::size_t n) : m_n(n) {}; std::size_t n() const { return m_n; } @@ -161,18 +161,18 @@ private: // Use these graph_traits parameterizations to refer to the associated // graph types. -typedef boost::graph_traits< ring_graph >::vertex_descriptor vertex_descriptor; -typedef boost::graph_traits< ring_graph >::edge_descriptor edge_descriptor; -typedef boost::graph_traits< ring_graph >::out_edge_iterator out_edge_iterator; -typedef boost::graph_traits< ring_graph >::in_edge_iterator in_edge_iterator; -typedef boost::graph_traits< ring_graph >::adjacency_iterator - adjacency_iterator; -typedef boost::graph_traits< ring_graph >::degree_size_type degree_size_type; -typedef boost::graph_traits< ring_graph >::vertex_iterator vertex_iterator; -typedef boost::graph_traits< ring_graph >::vertices_size_type - vertices_size_type; -typedef boost::graph_traits< ring_graph >::edge_iterator edge_iterator; -typedef boost::graph_traits< ring_graph >::edges_size_type edges_size_type; +using vertex_descriptor = boost::graph_traits< ring_graph >::vertex_descriptor; +using edge_descriptor = boost::graph_traits< ring_graph >::edge_descriptor; +using out_edge_iterator = boost::graph_traits< ring_graph >::out_edge_iterator; +using in_edge_iterator = boost::graph_traits< ring_graph >::in_edge_iterator; +using adjacency_iterator + = boost::graph_traits< ring_graph >::adjacency_iterator; +using degree_size_type = boost::graph_traits< ring_graph >::degree_size_type; +using vertex_iterator = boost::graph_traits< ring_graph >::vertex_iterator; +using vertices_size_type + = boost::graph_traits< ring_graph >::vertices_size_type; +using edge_iterator = boost::graph_traits< ring_graph >::edge_iterator; +using edges_size_type = boost::graph_traits< ring_graph >::edges_size_type; // Tag values passed to an iterator constructor to specify whether it should // be created at the start or the end of its range. @@ -295,8 +295,8 @@ class ring_adjacency_iterator { // The parent class is an iterator_adpator that turns an iterator over // out edges into an iterator over adjacent vertices. - typedef boost::adjacency_iterator_generator< ring_graph, vertex_descriptor, - out_edge_iterator >::type parent_class; + using parent_class = boost::adjacency_iterator_generator< ring_graph, + vertex_descriptor, out_edge_iterator >::type; public: ring_adjacency_iterator() {}; @@ -395,10 +395,10 @@ Map from edges to weight values */ struct edge_weight_map { - typedef double value_type; - typedef value_type reference; - typedef edge_descriptor key_type; - typedef boost::readable_property_map_tag category; + using value_type = double; + using reference = value_type; + using key_type = edge_descriptor; + using category = boost::readable_property_map_tag; // Edges have a weight equal to the average of their endpoint indexes. reference operator[](key_type e) const @@ -409,12 +409,12 @@ struct edge_weight_map // Use these propety_map and property_traits parameterizations to refer to // the associated property map types. -typedef boost::property_map< ring_graph, boost::edge_weight_t >::const_type - const_edge_weight_map; -typedef boost::property_traits< const_edge_weight_map >::reference - edge_weight_map_value_type; -typedef boost::property_traits< const_edge_weight_map >::key_type - edge_weight_map_key; +using const_edge_weight_map + = boost::property_map< ring_graph, boost::edge_weight_t >::const_type; +using edge_weight_map_value_type + = boost::property_traits< const_edge_weight_map >::reference; +using edge_weight_map_key + = boost::property_traits< const_edge_weight_map >::key_type; // PropertyMap valid expressions edge_weight_map_value_type get( diff --git a/example/in_edges.cpp b/example/in_edges.cpp index 1c27aa45..52efc3f9 100644 --- a/example/in_edges.cpp +++ b/example/in_edges.cpp @@ -30,7 +30,7 @@ int main(int, char*[]) using namespace std; using namespace boost; - typedef adjacency_list< listS, vecS, bidirectionalS > Graph; + using Graph = adjacency_list< listS, vecS, bidirectionalS >; const int num_vertices = 5; Graph g(num_vertices); diff --git a/example/inclusive_mean_geodesic.cpp b/example/inclusive_mean_geodesic.cpp index ef88a720..773b031c 100644 --- a/example/inclusive_mean_geodesic.cpp +++ b/example/inclusive_mean_geodesic.cpp @@ -24,8 +24,8 @@ template < typename Graph, typename DistanceType, typename ResultType, typename Divides = divides< ResultType > > struct inclusive_average { - typedef DistanceType distance_type; - typedef ResultType result_type; + using distance_type = DistanceType; + using result_type = ResultType; result_type operator()(distance_type d, const Graph& g) { @@ -56,30 +56,30 @@ struct Link }; // Declare the graph type and its vertex and edge types. -typedef directed_graph< WebPage, Link > Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = directed_graph< WebPage, Link >; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; // The name map provides an abstract accessor for the names of // each vertex. This is used during graph creation. -typedef property_map< Graph, string WebPage::* >::type NameMap; +using NameMap = property_map< Graph, string WebPage::* >::type; // Declare a matrix type and its corresponding property map that // will contain the distances between each pair of vertices. -typedef exterior_vertex_property< Graph, float > DistanceProperty; -typedef DistanceProperty::matrix_type DistanceMatrix; -typedef DistanceProperty::matrix_map_type DistanceMatrixMap; +using DistanceProperty = exterior_vertex_property< Graph, float >; +using DistanceMatrix = DistanceProperty::matrix_type; +using DistanceMatrixMap = DistanceProperty::matrix_map_type; // Declare the weight map as an accessor into the bundled // edge property. -typedef property_map< Graph, float Link::* >::type WeightMap; +using WeightMap = property_map< Graph, float Link::* >::type; // Declare a container and its corresponding property map that // will contain the resulting mean geodesic distances of each // vertex in the graph. -typedef exterior_vertex_property< Graph, float > GeodesicProperty; -typedef GeodesicProperty::container_type GeodesicContainer; -typedef GeodesicProperty::map_type GeodesicMap; +using GeodesicProperty = exterior_vertex_property< Graph, float >; +using GeodesicContainer = GeodesicProperty::container_type; +using GeodesicMap = GeodesicProperty::map_type; static float exclusive_geodesics(const Graph&, DistanceMatrixMap, GeodesicMap); static float inclusive_geodesics(const Graph&, DistanceMatrixMap, GeodesicMap); diff --git a/example/incremental-components-eg.cpp b/example/incremental-components-eg.cpp index 7fead1d9..54561ea9 100644 --- a/example/incremental-components-eg.cpp +++ b/example/incremental-components-eg.cpp @@ -20,10 +20,10 @@ using namespace boost; int main(int argc, char* argv[]) { - typedef adjacency_list< vecS, vecS, undirectedS > Graph; - typedef graph_traits< Graph >::vertex_descriptor Vertex; - // typedef graph_traits::edge_descriptor Edge; - typedef graph_traits< Graph >::vertices_size_type VertexIndex; + using Graph = adjacency_list< vecS, vecS, undirectedS >; + using Vertex = graph_traits< Graph >::vertex_descriptor; + // using Edge = graph_traits::edge_descriptor; + using VertexIndex = graph_traits< Graph >::vertices_size_type; // Create a graph const int VERTEX_COUNT = 6; @@ -37,8 +37,8 @@ int main(int argc, char* argv[]) std::vector< Vertex > rank(num_vertices(graph)); std::vector< Vertex > parent(num_vertices(graph)); - typedef VertexIndex* Rank; - typedef Vertex* Parent; + using Rank = VertexIndex*; + using Parent = Vertex*; disjoint_sets< Rank, Parent > ds(&rank[0], &parent[0]); // Determine the connected components, storing the results in the @@ -65,7 +65,7 @@ int main(int argc, char* argv[]) // index map into the component_index constructor if our graph type // used listS instead of vecS (identity_property_map is used by // default). - typedef component_index< VertexIndex > Components; + using Components = component_index< VertexIndex >; Components components(parent.begin(), parent.end()); // Iterate through the component indices diff --git a/example/incremental_components.cpp b/example/incremental_components.cpp index 249e16bd..f2269269 100644 --- a/example/incremental_components.cpp +++ b/example/incremental_components.cpp @@ -49,9 +49,9 @@ using namespace boost; int main(int argc, char* argv[]) { - typedef adjacency_list< vecS, vecS, undirectedS > Graph; - typedef graph_traits< Graph >::vertex_descriptor Vertex; - typedef graph_traits< Graph >::vertices_size_type VertexIndex; + using Graph = adjacency_list< vecS, vecS, undirectedS >; + using Vertex = graph_traits< Graph >::vertex_descriptor; + using VertexIndex = graph_traits< Graph >::vertices_size_type; const int VERTEX_COUNT = 6; Graph graph(VERTEX_COUNT); @@ -59,8 +59,8 @@ int main(int argc, char* argv[]) std::vector< VertexIndex > rank(num_vertices(graph)); std::vector< Vertex > parent(num_vertices(graph)); - typedef VertexIndex* Rank; - typedef Vertex* Parent; + using Rank = VertexIndex*; + using Parent = Vertex*; disjoint_sets< Rank, Parent > ds(&rank[0], &parent[0]); @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) std::cout << std::endl; - typedef component_index< VertexIndex > Components; + using Components = component_index< VertexIndex >; // NOTE: Because we're using vecS for the graph type, we're // effectively using identity_property_map for a vertex index map. diff --git a/example/influence_prestige.cpp b/example/influence_prestige.cpp index b5cc9e92..c06a3134 100644 --- a/example/influence_prestige.cpp +++ b/example/influence_prestige.cpp @@ -24,20 +24,20 @@ struct Actor }; // Declare the graph type and its vertex and edge types. -typedef directed_graph< Actor > Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = directed_graph< Actor >; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; // The name map provides an abstract accessor for the names of // each vertex. This is used during graph creation. -typedef property_map< Graph, string Actor::* >::type NameMap; +using NameMap = property_map< Graph, string Actor::* >::type; // Declare a container type for influence and prestige (both // of which are degree centralities) and its corresponding // property map. -typedef exterior_vertex_property< Graph, unsigned > CentralityProperty; -typedef CentralityProperty::container_type CentralityContainer; -typedef CentralityProperty::map_type CentralityMap; +using CentralityProperty = exterior_vertex_property< Graph, unsigned >; +using CentralityContainer = CentralityProperty::container_type; +using CentralityMap = CentralityProperty::map_type; int main(int argc, char* argv[]) { diff --git a/example/interior_pmap_bundled.cpp b/example/interior_pmap_bundled.cpp index 6121e8e2..11c51741 100644 --- a/example/interior_pmap_bundled.cpp +++ b/example/interior_pmap_bundled.cpp @@ -66,9 +66,9 @@ int main() { // Create the graph, and specify that we will use std::string to // store the first name's. - typedef adjacency_list< vecS, vecS, directedS, VertexData > MyGraphType; + using MyGraphType = adjacency_list< vecS, vecS, directedS, VertexData >; - typedef pair< int, int > Pair; + using Pair = pair< int, int >; Pair edge_array[11] = { Pair(0, 1), Pair(0, 2), Pair(0, 3), Pair(0, 4), Pair(2, 0), Pair(3, 0), Pair(2, 4), Pair(3, 1), Pair(3, 4), Pair(4, 0), Pair(4, 1) }; diff --git a/example/interior_property_map.cpp b/example/interior_property_map.cpp index 92f3bddf..4e6fc580 100644 --- a/example/interior_property_map.cpp +++ b/example/interior_property_map.cpp @@ -59,11 +59,11 @@ template < class EdgeIter, class Graph > void who_owes_who(EdgeIter first, EdgeIter last, const Graph& G) { // Access the propety acessor type for this graph - typedef - typename property_map< Graph, vertex_first_name_t >::const_type NamePA; + using NamePA = + typename property_map< Graph, vertex_first_name_t >::const_type; auto name = get(vertex_first_name, G); - typedef typename boost::property_traits< NamePA >::value_type NameType; + using NameType = typename boost::property_traits< NamePA >::value_type; NameType src_name, targ_name; @@ -81,11 +81,10 @@ int main() { // Create the graph, and specify that we will use std::string to // store the first name's. - typedef adjacency_list< vecS, vecS, directedS, - property< vertex_first_name_t, std::string > > - MyGraphType; + using MyGraphType = adjacency_list< vecS, vecS, directedS, + property< vertex_first_name_t, std::string > >; - typedef pair< int, int > Pair; + using Pair = pair< int, int >; Pair edge_array[11] = { Pair(0, 1), Pair(0, 2), Pair(0, 3), Pair(0, 4), Pair(2, 0), Pair(3, 0), Pair(2, 4), Pair(3, 1), Pair(3, 4), Pair(4, 0), Pair(4, 1) }; diff --git a/example/isomorphism.cpp b/example/isomorphism.cpp index 6a21520b..a529314a 100644 --- a/example/isomorphism.cpp +++ b/example/isomorphism.cpp @@ -22,9 +22,8 @@ int main() const int n = 12; - typedef adjacency_list< vecS, listS, undirectedS, - property< vertex_index_t, int > > - graph_t; + using graph_t = adjacency_list< vecS, listS, undirectedS, + property< vertex_index_t, int > >; graph_t g1(n), g2(n); std::vector< graph_traits< graph_t >::vertex_descriptor > v1(n), v2(n); diff --git a/example/johnson-eg.cpp b/example/johnson-eg.cpp index 025bdafe..30dbd6d6 100644 --- a/example/johnson-eg.cpp +++ b/example/johnson-eg.cpp @@ -18,11 +18,10 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, directedS, no_property, - property< edge_weight_t, int, property< edge_weight2_t, int > > > - Graph; + using Graph = adjacency_list< vecS, vecS, directedS, no_property, + property< edge_weight_t, int, property< edge_weight2_t, int > > >; const int V = 6; - typedef std::pair< int, int > Edge; + using Edge = std::pair< int, int >; Edge edge_array[] = { Edge(0, 1), Edge(0, 2), Edge(0, 3), Edge(0, 4), Edge(0, 5), Edge(1, 2), Edge(1, 5), Edge(1, 3), Edge(2, 4), Edge(2, 5), Edge(3, 2), Edge(4, 3), Edge(4, 1), Edge(5, 4) }; diff --git a/example/kevin-bacon.cpp b/example/kevin-bacon.cpp index 97417b03..5f76e0e6 100644 --- a/example/kevin-bacon.cpp +++ b/example/kevin-bacon.cpp @@ -52,17 +52,16 @@ int main(int argc, const char** argv) return EXIT_FAILURE; } - typedef adjacency_list< vecS, vecS, undirectedS, + using Graph = adjacency_list< vecS, vecS, undirectedS, property< vertex_name_t, std::string >, - property< edge_name_t, std::string > > - Graph; + property< edge_name_t, std::string > >; Graph g; auto actor_name = get(vertex_name, g); auto connecting_movie = get(edge_name, g); - typedef graph_traits< Graph >::vertex_descriptor Vertex; - typedef std::map< std::string, Vertex > NameVertexMap; + using Vertex = graph_traits< Graph >::vertex_descriptor; + using NameVertexMap = std::map< std::string, Vertex >; NameVertexMap actors; for (std::string line; std::getline(datafile, line);) diff --git a/example/kevin-bacon2.cpp b/example/kevin-bacon2.cpp index abe88a66..dbdafabf 100644 --- a/example/kevin-bacon2.cpp +++ b/example/kevin-bacon2.cpp @@ -52,11 +52,10 @@ struct edge_properties using namespace boost; -typedef adjacency_list< vecS, vecS, undirectedS, vertex_properties, - edge_properties > - Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = adjacency_list< vecS, vecS, undirectedS, vertex_properties, + edge_properties >; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; class bacon_number_recorder : public default_bfs_visitor { diff --git a/example/king_ordering.cpp b/example/king_ordering.cpp index 211f2540..220c5c98 100644 --- a/example/king_ordering.cpp +++ b/example/king_ordering.cpp @@ -33,14 +33,13 @@ int main(int, char*[]) { using namespace boost; using namespace std; - typedef adjacency_list< vecS, vecS, undirectedS, + using Graph = adjacency_list< vecS, vecS, undirectedS, property< vertex_color_t, default_color_type, - property< vertex_degree_t, int > > > - Graph; - typedef graph_traits< Graph >::vertex_descriptor Vertex; - typedef graph_traits< Graph >::vertices_size_type size_type; + property< vertex_degree_t, int > > >; + using Vertex = graph_traits< Graph >::vertex_descriptor; + using size_type = graph_traits< Graph >::vertices_size_type; - typedef std::pair< std::size_t, std::size_t > Pair; + using Pair = std::pair< std::size_t, std::size_t >; Pair edges[14] = { Pair(0, 3), // a-d Pair(0, 5), // a-f Pair(1, 2), // b-c diff --git a/example/knights_tour.cpp b/example/knights_tour.cpp index 31b8945e..91bfda83 100644 --- a/example/knights_tour.cpp +++ b/example/knights_tour.cpp @@ -18,7 +18,7 @@ using namespace boost; -typedef std::pair< int, int > Position; +using Position = std::pair< int, int >; Position knight_jumps[8] = { Position(2, -1), Position(1, -2), Position(-1, -2), Position(-2, -1), Position(-2, 1), Position(-1, 2), Position(1, 2), Position(2, 1) }; @@ -59,19 +59,19 @@ protected: struct knights_tour_graph { - typedef Position vertex_descriptor; - typedef std::pair< vertex_descriptor, vertex_descriptor > edge_descriptor; - typedef knight_adjacency_iterator adjacency_iterator; - typedef void out_edge_iterator; - typedef void in_edge_iterator; - typedef void edge_iterator; - typedef void vertex_iterator; - typedef int degree_size_type; - typedef int vertices_size_type; - typedef int edges_size_type; - typedef directed_tag directed_category; - typedef disallow_parallel_edge_tag edge_parallel_category; - typedef adjacency_graph_tag traversal_category; + using vertex_descriptor = Position; + using edge_descriptor = std::pair< vertex_descriptor, vertex_descriptor >; + using adjacency_iterator = knight_adjacency_iterator; + using out_edge_iterator = void; + using in_edge_iterator = void; + using edge_iterator = void; + using vertex_iterator = void; + using degree_size_type = int; + using vertices_size_type = int; + using edges_size_type = int; + using directed_category = directed_tag; + using edge_parallel_category = disallow_parallel_edge_tag; + using traversal_category = adjacency_graph_tag; knights_tour_graph(int n) : m_board_size(n) {} int m_board_size; }; @@ -98,7 +98,7 @@ std::pair< knights_tour_graph::adjacency_iterator, adjacent_vertices( knights_tour_graph::vertex_descriptor v, const knights_tour_graph& g) { - typedef knights_tour_graph::adjacency_iterator Iter; + using Iter = knights_tour_graph::adjacency_iterator; return std::make_pair(Iter(0, v, g), Iter(8, v, g)); } @@ -115,8 +115,8 @@ bool backtracking_search(Graph& g, typename graph_traits< Graph >::vertex_descriptor src, TimePropertyMap time_map) { - typedef typename graph_traits< Graph >::vertex_descriptor Vertex; - typedef std::pair< int, Vertex > P; + using Vertex = typename graph_traits< Graph >::vertex_descriptor; + using P = std::pair< int, Vertex >; std::stack< P > S; int time_stamp = 0; @@ -171,8 +171,8 @@ template < typename Graph, typename TimePropertyMap > bool warnsdorff(Graph& g, typename graph_traits< Graph >::vertex_descriptor src, TimePropertyMap time_map) { - typedef typename graph_traits< Graph >::vertex_descriptor Vertex; - typedef std::pair< int, Vertex > P; + using Vertex = typename graph_traits< Graph >::vertex_descriptor; + using P = std::pair< int, Vertex >; std::stack< P > S; int time_stamp = 0; @@ -222,9 +222,9 @@ bool warnsdorff(Graph& g, typename graph_traits< Graph >::vertex_descriptor src, struct board_map { - typedef int value_type; - typedef Position key_type; - typedef read_write_property_map_tag category; + using value_type = int; + using key_type = Position; + using category = read_write_property_map_tag; board_map(int* b, int n) : m_board(b), m_size(n) {} friend int get(const board_map& ba, Position p); friend void put(const board_map& ba, Position p, int v); diff --git a/example/kruskal-example.cpp b/example/kruskal-example.cpp index 890f03a1..9433f090 100644 --- a/example/kruskal-example.cpp +++ b/example/kruskal-example.cpp @@ -13,11 +13,10 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, undirectedS, no_property, - property< edge_weight_t, int > > - Graph; - typedef graph_traits< Graph >::edge_descriptor Edge; - typedef std::pair< int, int > E; + using Graph = adjacency_list< vecS, vecS, undirectedS, no_property, + property< edge_weight_t, int > >; + using Edge = graph_traits< Graph >::edge_descriptor; + using E = std::pair< int, int >; const int num_nodes = 5; E edge_array[] = { E(0, 2), E(1, 3), E(1, 4), E(2, 1), E(2, 3), E(3, 4), diff --git a/example/kruskal-telephone.cpp b/example/kruskal-telephone.cpp index e4a48ab9..7e4ae930 100644 --- a/example/kruskal-telephone.cpp +++ b/example/kruskal-telephone.cpp @@ -26,9 +26,8 @@ int main() GraphvizGraph g_dot; read_graphviz("figs/telephone-network.dot", g_dot); - typedef adjacency_list< vecS, vecS, undirectedS, no_property, - property< edge_weight_t, int > > - Graph; + using Graph = adjacency_list< vecS, vecS, undirectedS, no_property, + property< edge_weight_t, int > >; Graph g(num_vertices(g_dot)); auto edge_attr_map = get(edge_attribute, g_dot); graph_traits< GraphvizGraph >::edge_iterator ei, ei_end; @@ -40,8 +39,8 @@ int main() } std::vector< graph_traits< Graph >::edge_descriptor > mst; - typedef std::vector< graph_traits< Graph >::edge_descriptor >::size_type - size_type; + using size_type + = std::vector< graph_traits< Graph >::edge_descriptor >::size_type; kruskal_minimum_spanning_tree(g, std::back_inserter(mst)); auto weight = get(edge_weight, g); @@ -50,7 +49,7 @@ int main() total_weight += get(weight, edge); std::cout << "total weight: " << total_weight << std::endl; - typedef graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = graph_traits< Graph >::vertex_descriptor; for (auto const& edge : mst) { auto u = source(edge, g), v = target(edge, g); diff --git a/example/kuratowski_subgraph.cpp b/example/kuratowski_subgraph.cpp index 3ce3f269..6fe19234 100644 --- a/example/kuratowski_subgraph.cpp +++ b/example/kuratowski_subgraph.cpp @@ -21,9 +21,8 @@ using namespace boost; int main(int argc, char** argv) { - typedef adjacency_list< vecS, vecS, undirectedS, - property< vertex_index_t, int >, property< edge_index_t, int > > - graph; + using graph = adjacency_list< vecS, vecS, undirectedS, + property< vertex_index_t, int >, property< edge_index_t, int > >; // Create a K_6 (complete graph on 6 vertices), which // contains both Kuratowski subgraphs as minors. @@ -53,8 +52,8 @@ int main(int argc, char** argv) // Test for planarity - we know it is not planar, we just want to // compute the kuratowski subgraph as a side-effect - typedef std::vector< graph_traits< graph >::edge_descriptor > - kuratowski_edges_t; + using kuratowski_edges_t + = std::vector< graph_traits< graph >::edge_descriptor >; kuratowski_edges_t kuratowski_edges; if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g, boyer_myrvold_params::kuratowski_subgraph diff --git a/example/labeled_graph.cpp b/example/labeled_graph.cpp index 6224d768..0239ef02 100644 --- a/example/labeled_graph.cpp +++ b/example/labeled_graph.cpp @@ -27,10 +27,10 @@ int main() using namespace boost::graph_detail; - typedef directed_graph<> Digraph; + using Digraph = directed_graph<>; { - typedef labeled_graph< Digraph, unsigned > Graph; + using Graph = labeled_graph< Digraph, unsigned >; Graph g; add_vertex(1, g); add_vertex(2, g); @@ -39,14 +39,14 @@ int main() } { - typedef labeled_graph< Digraph, string > Graph; + using Graph = labeled_graph< Digraph, string >; Graph g; add_vertex("foo", g); add_vertex("bar", g); } { - typedef labeled_graph< Digraph, string, mapS > Graph; + using Graph = labeled_graph< Digraph, string, mapS >; Graph g; add_vertex("foo", g); add_vertex("bar", g); @@ -54,7 +54,7 @@ int main() } { - typedef labeled_graph< Digraph*, int > TempGraph; + using TempGraph = labeled_graph< Digraph*, int >; Digraph g; TempGraph h(&g); add_vertex(12, h); @@ -62,8 +62,8 @@ int main() { // This is actually a fairly complicated specialization. - typedef adjacency_list< vecS, vecS, bidirectionalS > G; - typedef labeled_graph< G, size_t > Graph; + using G = adjacency_list< vecS, vecS, bidirectionalS >; + using Graph = labeled_graph< G, size_t >; Graph g; add_vertex(0, g); add_vertex(1, g); diff --git a/example/last-mod-time.cpp b/example/last-mod-time.cpp index 7001fe4e..787f97e4 100644 --- a/example/last-mod-time.cpp +++ b/example/last-mod-time.cpp @@ -36,7 +36,7 @@ template < typename Graph, typename VertexNamePropertyMap > void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g, VertexNamePropertyMap name_map) { - typedef typename graph_traits< Graph >::vertices_size_type size_type; + using size_type = typename graph_traits< Graph >::vertices_size_type; size_type n_vertices; typename graph_traits< Graph >::vertex_descriptor u; typename property_traits< VertexNamePropertyMap >::value_type name; @@ -58,13 +58,12 @@ void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g, int main(int argc, const char** argv) { - typedef adjacency_list< listS, // Store out-edges of each vertex in a - // std::list + using graph_type = adjacency_list< listS, // Store out-edges of each vertex + // in a std::list vecS, // Store vertex set in a std::vector directedS, // The graph is directed property< vertex_name_t, std::string > // Add a vertex property - > - graph_type; + >; graph_type g; // use default constructor to create empty graph std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"), @@ -82,16 +81,15 @@ int main(int argc, const char** argv) // Create storage for last modified times std::vector< time_t > last_mod_vec(num_vertices(g)); // Create nickname for the property map type - typedef iterator_property_map< std::vector< time_t >::iterator, - property_map< graph_type, vertex_index_t >::type, time_t, time_t& > - iter_map_t; + using iter_map_t = iterator_property_map< std::vector< time_t >::iterator, + property_map< graph_type, vertex_index_t >::type, time_t, time_t& >; // Create last modified time property map iter_map_t mod_time_map(last_mod_vec.begin(), get(vertex_index, g)); auto name = get(vertex_name, g); struct stat stat_buf; graph_traits< graph_type >::vertex_descriptor u; - typedef graph_traits< graph_type >::vertex_iterator vertex_iter_t; + using vertex_iter_t = graph_traits< graph_type >::vertex_iterator; std::pair< vertex_iter_t, vertex_iter_t > p; for (p = vertices(g); p.first != p.second; ++p.first) { diff --git a/example/leda-concept-check.cpp b/example/leda-concept-check.cpp index 490d2d68..e6aa02c2 100644 --- a/example/leda-concept-check.cpp +++ b/example/leda-concept-check.cpp @@ -12,7 +12,7 @@ int main() { using namespace boost; - typedef leda::GRAPH< int, int > Graph; + using Graph = leda::GRAPH< int, int >; BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >)); BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >)); BOOST_CONCEPT_ASSERT((VertexMutableGraphConcept< Graph >)); diff --git a/example/leda-graph-eg.cpp b/example/leda-graph-eg.cpp index 008349d9..9d3c48df 100644 --- a/example/leda-graph-eg.cpp +++ b/example/leda-graph-eg.cpp @@ -11,14 +11,14 @@ int main() { using namespace boost; - typedef leda::GRAPH< std::string, int > graph_t; + using graph_t = leda::GRAPH< std::string, int >; graph_t g; g.new_node("Philoctetes"); g.new_node("Heracles"); g.new_node("Alcmena"); g.new_node("Eurystheus"); g.new_node("Amphitryon"); - typedef property_map< graph_t, vertex_all_t >::type NodeMap; + using NodeMap = property_map< graph_t, vertex_all_t >::type; auto node_name_map = get(vertex_all, g); graph_traits< graph_t >::vertex_iterator vi, vi_end; for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) diff --git a/example/loops_dfs.cpp b/example/loops_dfs.cpp index e080307b..ad28f671 100644 --- a/example/loops_dfs.cpp +++ b/example/loops_dfs.cpp @@ -57,7 +57,7 @@ void find_loops(typename graph_traits< Graph >::vertex_descriptor entry, Loops& loops) // A container of sets of vertices { BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >)); - typedef typename graph_traits< Graph >::edge_descriptor Edge; + using Edge = typename graph_traits< Graph >::edge_descriptor; std::vector< Edge > back_edges; std::vector< default_color_type > color_map(num_vertices(g)); depth_first_visit(g, entry, @@ -80,8 +80,8 @@ void compute_loop_extent( Set& loop_set) { BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >)); - typedef typename graph_traits< Graph >::vertex_descriptor Vertex; - typedef color_traits< default_color_type > Color; + using Vertex = typename graph_traits< Graph >::vertex_descriptor; + using Color = color_traits< default_color_type >; Vertex loop_head, loop_tail; loop_tail = source(back_edge, g); @@ -117,10 +117,9 @@ int main(int argc, char* argv[]) GraphvizDigraph g_in; read_graphviz(argv[1], g_in); - typedef adjacency_list< vecS, vecS, bidirectionalS, GraphvizVertexProperty, - GraphvizEdgeProperty, GraphvizGraphProperty > - Graph; - typedef graph_traits< Graph >::vertex_descriptor Vertex; + using Graph = adjacency_list< vecS, vecS, bidirectionalS, + GraphvizVertexProperty, GraphvizEdgeProperty, GraphvizGraphProperty >; + using Vertex = graph_traits< Graph >::vertex_descriptor; Graph g; #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 @@ -130,8 +129,8 @@ int main(int argc, char* argv[]) copy_graph(g_in, g); - typedef std::set< Vertex > set_t; - typedef std::list< set_t > list_of_sets_t; + using set_t = std::set< Vertex >; + using list_of_sets_t = std::list< set_t >; list_of_sets_t loops; auto entry = *vertices(g).first; diff --git a/example/make_biconnected_planar.cpp b/example/make_biconnected_planar.cpp index bf9a1d18..dfbf1808 100644 --- a/example/make_biconnected_planar.cpp +++ b/example/make_biconnected_planar.cpp @@ -22,9 +22,8 @@ using namespace boost; int main(int argc, char** argv) { - typedef adjacency_list< vecS, vecS, undirectedS, - property< vertex_index_t, int >, property< edge_index_t, int > > - graph; + using graph = adjacency_list< vecS, vecS, undirectedS, + property< vertex_index_t, int >, property< edge_index_t, int > >; graph g(11); add_edge(0, 1, g); @@ -48,7 +47,7 @@ int main(int argc, char** argv) put(e_index, *ei, edge_count++); // Test for planarity; compute the planar embedding as a side-effect - typedef std::vector< graph_traits< graph >::edge_descriptor > vec_t; + using vec_t = std::vector< graph_traits< graph >::edge_descriptor >; std::vector< vec_t > embedding(num_vertices(g)); if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g, boyer_myrvold_params::embedding = &embedding[0])) @@ -56,11 +55,11 @@ int main(int argc, char** argv) else std::cout << "Input graph is not planar" << std::endl; - typedef std::vector< graph_traits< graph >::edges_size_type > - component_storage_t; - typedef iterator_property_map< component_storage_t::iterator, - property_map< graph, edge_index_t >::type > - component_map_t; + using component_storage_t + = std::vector< graph_traits< graph >::edges_size_type >; + using component_map_t + = iterator_property_map< component_storage_t::iterator, + property_map< graph, edge_index_t >::type >; component_storage_t component_storage(num_edges(g)); component_map_t component(component_storage.begin(), get(edge_index, g)); diff --git a/example/make_connected.cpp b/example/make_connected.cpp index 84491b5e..afa1edcf 100644 --- a/example/make_connected.cpp +++ b/example/make_connected.cpp @@ -20,9 +20,8 @@ using namespace boost; int main(int argc, char** argv) { - typedef adjacency_list< vecS, vecS, undirectedS, - property< vertex_index_t, int > > - graph; + using graph = adjacency_list< vecS, vecS, undirectedS, + property< vertex_index_t, int > >; graph g(11); add_edge(0, 1, g); diff --git a/example/make_maximal_planar.cpp b/example/make_maximal_planar.cpp index 92b1294d..b160dfd8 100644 --- a/example/make_maximal_planar.cpp +++ b/example/make_maximal_planar.cpp @@ -37,9 +37,8 @@ struct face_counter : public planar_face_traversal_visitor int main(int argc, char** argv) { - typedef adjacency_list< vecS, vecS, undirectedS, - property< vertex_index_t, int >, property< edge_index_t, int > > - graph; + using graph = adjacency_list< vecS, vecS, undirectedS, + property< vertex_index_t, int >, property< edge_index_t, int > >; // Create the graph - a straight line graph g(10); @@ -67,7 +66,7 @@ int main(int argc, char** argv) put(e_index, *ei, edge_count++); // Test for planarity; compute the planar embedding as a side-effect - typedef std::vector< graph_traits< graph >::edge_descriptor > vec_t; + using vec_t = std::vector< graph_traits< graph >::edge_descriptor >; std::vector< vec_t > embedding(num_vertices(g)); if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g, boyer_myrvold_params::embedding = &embedding[0])) diff --git a/example/matching_example.cpp b/example/matching_example.cpp index 39c9b7cd..9870d8f6 100644 --- a/example/matching_example.cpp +++ b/example/matching_example.cpp @@ -15,7 +15,7 @@ using namespace boost; -typedef adjacency_list< vecS, vecS, undirectedS > my_graph; +using my_graph = adjacency_list< vecS, vecS, undirectedS >; int main() { diff --git a/example/max_flow.cpp b/example/max_flow.cpp index ca7eed5e..0d82d9d5 100644 --- a/example/max_flow.cpp +++ b/example/max_flow.cpp @@ -52,13 +52,12 @@ int main() { using namespace boost; - typedef adjacency_list_traits< vecS, vecS, directedS > Traits; - typedef adjacency_list< listS, vecS, directedS, + using Traits = adjacency_list_traits< vecS, vecS, directedS >; + using Graph = adjacency_list< listS, vecS, directedS, property< vertex_name_t, std::string >, property< edge_capacity_t, long, property< edge_residual_capacity_t, long, - property< edge_reverse_t, Traits::edge_descriptor > > > > - Graph; + property< edge_reverse_t, Traits::edge_descriptor > > > >; Graph g; diff --git a/example/mcgregor_subgraphs_example.cpp b/example/mcgregor_subgraphs_example.cpp index 287a47a9..98f82d00 100644 --- a/example/mcgregor_subgraphs_example.cpp +++ b/example/mcgregor_subgraphs_example.cpp @@ -26,7 +26,7 @@ using namespace boost; template < typename Graph > struct example_callback { - typedef typename graph_traits< Graph >::vertices_size_type VertexSizeFirst; + using VertexSizeFirst = typename graph_traits< Graph >::vertices_size_type; example_callback(const Graph& graph1) : m_graph1(graph1) {} @@ -38,9 +38,9 @@ template < typename Graph > struct example_callback { // Fill membership map for first graph - typedef - typename property_map< Graph, vertex_index_t >::type VertexIndexMap; - typedef shared_array_property_map< bool, VertexIndexMap > MembershipMap; + using VertexIndexMap = + typename property_map< Graph, vertex_index_t >::type; + using MembershipMap = shared_array_property_map< bool, VertexIndexMap >; MembershipMap membership_map1( num_vertices(m_graph1), get(vertex_index, m_graph1)); @@ -49,8 +49,9 @@ template < typename Graph > struct example_callback m_graph1, correspondence_map_1_to_2, membership_map1); // Generate filtered graphs using membership map - typedef typename membership_filtered_graph_traits< Graph, - MembershipMap >::graph_type MembershipFilteredGraph; + using MembershipFilteredGraph = + typename membership_filtered_graph_traits< Graph, + MembershipMap >::graph_type; MembershipFilteredGraph subgraph1 = make_membership_filtered_graph(m_graph1, membership_map1); @@ -75,11 +76,10 @@ int main(int argc, char* argv[]) // Using a vecS graph here so that we don't have to mess around with // a vertex index map; it will be implicit. - typedef adjacency_list< listS, vecS, directedS, + using Graph = adjacency_list< listS, vecS, directedS, property< vertex_name_t, unsigned int, property< vertex_index_t, unsigned int > >, - property< edge_name_t, unsigned int > > - Graph; + property< edge_name_t, unsigned int > >; // Test maximum and unique variants on known graphs Graph graph_simple1, graph_simple2; diff --git a/example/mean_geodesic.cpp b/example/mean_geodesic.cpp index 7b41bb3d..a99a21cb 100644 --- a/example/mean_geodesic.cpp +++ b/example/mean_geodesic.cpp @@ -24,29 +24,29 @@ struct Actor }; // Declare the graph type and its vertex and edge types. -typedef undirected_graph< Actor > Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = undirected_graph< Actor >; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; // The name map provides an abstract accessor for the names of // each vertex. This is used during graph creation. -typedef property_map< Graph, string Actor::* >::type NameMap; +using NameMap = property_map< Graph, string Actor::* >::type; // Declare a matrix type and its corresponding property map that // will contain the distances between each pair of vertices. -typedef exterior_vertex_property< Graph, int > DistanceProperty; -typedef DistanceProperty::matrix_type DistanceMatrix; -typedef DistanceProperty::matrix_map_type DistanceMatrixMap; +using DistanceProperty = exterior_vertex_property< Graph, int >; +using DistanceMatrix = DistanceProperty::matrix_type; +using DistanceMatrixMap = DistanceProperty::matrix_map_type; // Declare the weight map so that each edge returns the same value. -typedef constant_property_map< Edge, int > WeightMap; +using WeightMap = constant_property_map< Edge, int >; // Declare a container and its corresponding property map that // will contain the resulting mean geodesic distances of each // vertex in the graph. -typedef exterior_vertex_property< Graph, float > GeodesicProperty; -typedef GeodesicProperty::container_type GeodesicContainer; -typedef GeodesicProperty::map_type GeodesicMap; +using GeodesicProperty = exterior_vertex_property< Graph, float >; +using GeodesicContainer = GeodesicProperty::container_type; +using GeodesicMap = GeodesicProperty::map_type; int main(int argc, char* argv[]) { diff --git a/example/miles_span.cpp b/example/miles_span.cpp index 66d7cb9a..b647ae61 100644 --- a/example/miles_span.cpp +++ b/example/miles_span.cpp @@ -25,7 +25,7 @@ template < class Distance > struct total_length_visitor : public boost::dijkstra_visitor<> { - typedef typename boost::property_traits< Distance >::value_type D; + using D = typename boost::property_traits< Distance >::value_type; total_length_visitor(D& len, Distance d) : _total_length(len), _distance(d) { } diff --git a/example/min_max_paths.cpp b/example/min_max_paths.cpp index a35bc4cc..7623bd57 100644 --- a/example/min_max_paths.cpp +++ b/example/min_max_paths.cpp @@ -42,12 +42,11 @@ int main(int, char*[]) { using namespace boost; - typedef adjacency_list< listS, vecS, directedS, no_property, - property< edge_weight_t, int > > - Graph; - typedef graph_traits< Graph >::vertex_descriptor Vertex; + using Graph = adjacency_list< listS, vecS, directedS, no_property, + property< edge_weight_t, int > >; + using Vertex = graph_traits< Graph >::vertex_descriptor; - typedef std::pair< int, int > E; + using E = std::pair< int, int >; const char name[] = "abcdef"; diff --git a/example/minimum_degree_ordering.cpp b/example/minimum_degree_ordering.cpp index 38044a16..0b22ea5f 100644 --- a/example/minimum_degree_ordering.cpp +++ b/example/minimum_degree_ordering.cpp @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) harwell_boeing hbs(argv[1]); // must be BGL directed graph now - typedef adjacency_list< vecS, vecS, directedS > Graph; + using Graph = adjacency_list< vecS, vecS, directedS >; int n = hbs.nrows(); @@ -139,7 +139,7 @@ int main(int argc, char* argv[]) cout << "number of off-diagnal elements: " << num_edge << endl; - typedef std::vector< int > Vector; + using Vector = std::vector< int >; Vector inverse_perm(n, 0); Vector perm(n, 0); diff --git a/example/modify_graph.cpp b/example/modify_graph.cpp index acad2c47..04ccc733 100644 --- a/example/modify_graph.cpp +++ b/example/modify_graph.cpp @@ -40,9 +40,9 @@ inline name_equals_predicate< NamePropertyMap > name_equals( template < class MutableGraph > void modify_demo(MutableGraph& g) { - typedef graph_traits< MutableGraph > GraphTraits; - typedef typename GraphTraits::vertices_size_type size_type; - typedef typename GraphTraits::edge_descriptor edge_descriptor; + using GraphTraits = graph_traits< MutableGraph >; + using size_type = typename GraphTraits::vertices_size_type; + using edge_descriptor = typename GraphTraits::edge_descriptor; size_type n = 0; typename GraphTraits::edges_size_type m = 0; typename GraphTraits::vertex_descriptor u, v, w; diff --git a/example/neighbor_bfs.cpp b/example/neighbor_bfs.cpp index ca3e2d76..a7b8023c 100644 --- a/example/neighbor_bfs.cpp +++ b/example/neighbor_bfs.cpp @@ -53,8 +53,8 @@ template < class ParentDecorator > struct print_parent template < class DistanceMap, class PredecessorMap, class ColorMap > class distance_and_pred_visitor : public neighbor_bfs_visitor<> { - typedef typename property_traits< ColorMap >::value_type ColorValue; - typedef color_traits< ColorValue > Color; + using ColorValue = typename property_traits< ColorMap >::value_type; + using Color = color_traits< ColorValue >; public: distance_and_pred_visitor(DistanceMap d, PredecessorMap p, ColorMap c) @@ -84,11 +84,10 @@ public: int main(int, char*[]) { - typedef adjacency_list< mapS, vecS, bidirectionalS, - property< vertex_color_t, default_color_type > > - Graph; + using Graph = adjacency_list< mapS, vecS, bidirectionalS, + property< vertex_color_t, default_color_type > >; - typedef property_map< Graph, vertex_color_t >::type ColorMap; + using ColorMap = property_map< Graph, vertex_color_t >::type; Graph G(5); add_edge(0, 2, G); @@ -103,19 +102,19 @@ int main(int, char*[]) add_edge(4, 0, G); add_edge(4, 1, G); - typedef Graph::vertex_descriptor Vertex; + using Vertex = Graph::vertex_descriptor; // Array to store predecessor (parent) of each vertex. This will be // used as a Decorator (actually, its iterator will be). std::vector< Vertex > p(num_vertices(G)); // VC++ version of std::vector has no ::pointer, so // I use ::value_type* instead. - typedef std::vector< Vertex >::value_type* Piter; + using Piter = std::vector< Vertex >::value_type*; // Array to store distances from the source to each vertex . We use // a built-in array here just for variety. This will also be used as // a Decorator. - typedef graph_traits< Graph >::vertices_size_type size_type; + using size_type = graph_traits< Graph >::vertices_size_type; size_type d[5]; std::fill_n(d, 5, 0); diff --git a/example/ordered_out_edges.cpp b/example/ordered_out_edges.cpp index 16003f88..fda38539 100644 --- a/example/ordered_out_edges.cpp +++ b/example/ordered_out_edges.cpp @@ -42,9 +42,9 @@ template < class StoredEdge > struct order_by_name { - typedef StoredEdge first_argument_type; - typedef StoredEdge second_argument_type; - typedef bool result_type; + using first_argument_type = StoredEdge; + using second_argument_type = StoredEdge; + using result_type = bool; bool operator()(const StoredEdge& e1, const StoredEdge& e2) const { // Order by target vertex, then by name. @@ -64,7 +64,7 @@ namespace boost template < class ValueType > struct container_gen< ordered_set_by_nameS, ValueType > { - typedef std::multiset< ValueType, order_by_name< ValueType > > type; + using type = std::multiset< ValueType, order_by_name< ValueType > >; }; } #else @@ -72,14 +72,16 @@ struct ordered_set_by_nameS { template < class T > struct bind_ { - typedef std::multiset< T, order_by_name< T > > type; - }; + using + } = std::multiset< T, order_by_name< T > > type; + ; +}; }; namespace boost { template <> struct container_selector< ordered_set_by_nameS > { - typedef ordered_set_by_nameS type; + using type = ordered_set_by_nameS; }; } #endif @@ -88,7 +90,7 @@ namespace boost { template <> struct parallel_edge_traits< ordered_set_by_nameS > { - typedef allow_parallel_edge_tag type; + using type = allow_parallel_edge_tag; }; } @@ -98,10 +100,9 @@ int main() std::cout << "This program requires partial specialization" << std::endl; #else using namespace boost; - typedef property< edge_name_t, std::string > EdgeProperty; - typedef adjacency_list< ordered_set_by_nameS, vecS, undirectedS, - no_property, EdgeProperty > - graph_type; + using EdgeProperty = property< edge_name_t, std::string >; + using graph_type = adjacency_list< ordered_set_by_nameS, vecS, undirectedS, + no_property, EdgeProperty >; graph_type g; add_edge(0, 1, EdgeProperty("joe"), g); @@ -128,7 +129,7 @@ int main() std::cout << std::endl; bool found; - typedef graph_traits< graph_type > Traits; + using Traits = graph_traits< graph_type >; Traits::edge_descriptor e; Traits::out_edge_iterator e_first, e_last; diff --git a/example/ospf-example.cpp b/example/ospf-example.cpp index d0b44df2..411fc9c3 100644 --- a/example/ospf-example.cpp +++ b/example/ospf-example.cpp @@ -22,11 +22,10 @@ BOOST_INSTALL_PROPERTY(graph, color); int main(int argc, const char** argv) { using namespace boost; - typedef adjacency_list< vecS, vecS, directedS, + using g_dot_type = adjacency_list< vecS, vecS, directedS, property< vertex_name_t, std::string >, property< edge_color_t, std::string, property< edge_weight_t, int > >, - property< graph_color_t, std::string > > - g_dot_type; + property< graph_color_t, std::string > >; g_dot_type g_dot; dynamic_properties dp(ignore_other_properties); @@ -41,10 +40,9 @@ int main(int argc, const char** argv) read_graphviz(infile, g_dot, dp); } - typedef adjacency_list< vecS, vecS, directedS, no_property, - property< edge_weight_t, int > > - Graph; - typedef graph_traits< Graph >::vertex_descriptor vertex_descriptor; + using Graph = adjacency_list< vecS, vecS, directedS, no_property, + property< edge_weight_t, int > >; + using vertex_descriptor = graph_traits< Graph >::vertex_descriptor; Graph g(num_vertices(g_dot)); graph_traits< g_dot_type >::edge_iterator ei, ei_end; for (boost::tie(ei, ei_end) = edges(g_dot); ei != ei_end; ++ei) @@ -65,7 +63,7 @@ int main(int argc, const char** argv) std::vector< vertex_descriptor > parent(num_vertices(g)); // All vertices start out as there own parent - typedef graph_traits< Graph >::vertices_size_type size_type; + using size_type = graph_traits< Graph >::vertices_size_type; for (size_type p = 0; p < num_vertices(g); ++p) parent[p] = p; diff --git a/example/parallel-compile-time.cpp b/example/parallel-compile-time.cpp index 22c6e479..e3ee3bf4 100644 --- a/example/parallel-compile-time.cpp +++ b/example/parallel-compile-time.cpp @@ -36,27 +36,27 @@ BOOST_INSTALL_PROPERTY(vertex, compile_cost); using namespace boost; -typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list - listS, // Store vertex set in a std::list - directedS, // The file dependency graph is directed - // vertex properties - property< vertex_name_t, std::string, - property< vertex_compile_cost_t, float, - property< vertex_distance_t, float, - property< vertex_color_t, default_color_type > > > >, - // an edge property - property< edge_weight_t, float > > - file_dep_graph2; +using file_dep_graph2 + = adjacency_list< listS, // Store out-edges of each vertex in a std::list + listS, // Store vertex set in a std::list + directedS, // The file dependency graph is directed + // vertex properties + property< vertex_name_t, std::string, + property< vertex_compile_cost_t, float, + property< vertex_distance_t, float, + property< vertex_color_t, default_color_type > > > >, + // an edge property + property< edge_weight_t, float > >; -typedef graph_traits< file_dep_graph2 >::vertex_descriptor vertex_t; -typedef graph_traits< file_dep_graph2 >::edge_descriptor edge_t; +using vertex_t = graph_traits< file_dep_graph2 >::vertex_descriptor; +using edge_t = graph_traits< file_dep_graph2 >::edge_descriptor; template < typename Graph, typename ColorMap, typename Visitor > void dfs_v2(const Graph& g, typename graph_traits< Graph >::vertex_descriptor u, ColorMap color, Visitor vis) { - typedef typename property_traits< ColorMap >::value_type color_type; - typedef color_traits< color_type > ColorT; + using color_type = typename property_traits< ColorMap >::value_type; + using ColorT = color_traits< color_type >; color[u] = ColorT::gray(); vis.discover_vertex(u, g); typename graph_traits< Graph >::out_edge_iterator ei, ei_end; @@ -77,8 +77,8 @@ void dfs_v2(const Graph& g, typename graph_traits< Graph >::vertex_descriptor u, template < typename Graph, typename Visitor, typename ColorMap > void generic_dfs_v2(const Graph& g, Visitor vis, ColorMap color) { - typedef typename property_traits< ColorMap >::value_type ColorValue; - typedef color_traits< ColorValue > ColorT; + using ColorValue = typename property_traits< ColorMap >::value_type; + using ColorT = color_traits< ColorValue >; typename graph_traits< Graph >::vertex_iterator vi, vi_end; for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) color[*vi] = ColorT::white(); @@ -107,16 +107,16 @@ void topo_sort(const Graph& g, OutputIterator topo_order, ColorMap color) generic_dfs_v2(g, vis, color); } -typedef property_map< file_dep_graph2, vertex_name_t >::type name_map_t; -typedef property_map< file_dep_graph2, vertex_compile_cost_t >::type - compile_cost_map_t; -typedef property_map< file_dep_graph2, vertex_distance_t >::type distance_map_t; -typedef property_map< file_dep_graph2, vertex_color_t >::type color_map_t; +using name_map_t = property_map< file_dep_graph2, vertex_name_t >::type; +using compile_cost_map_t + = property_map< file_dep_graph2, vertex_compile_cost_t >::type; +using distance_map_t = property_map< file_dep_graph2, vertex_distance_t >::type; +using color_map_t = property_map< file_dep_graph2, vertex_color_t >::type; int main(int argc, const char** argv) { std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"); - typedef graph_traits< file_dep_graph2 >::vertices_size_type size_type; + using size_type = graph_traits< file_dep_graph2 >::vertices_size_type; size_type n_vertices; file_in >> n_vertices; // read in number of vertices std::istream_iterator< std::pair< size_type, size_type > > input_begin( @@ -125,7 +125,7 @@ int main(int argc, const char** argv) #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // VC++ can't handle the iterator constructor file_dep_graph2 g; - typedef graph_traits< file_dep_graph2 >::vertex_descriptor vertex_t; + using vertex_t = graph_traits< file_dep_graph2 >::vertex_descriptor; std::vector< vertex_t > id2vertex; for (std::size_t v = 0; v < n_vertices; ++v) id2vertex.push_back(add_vertex(g)); diff --git a/example/planar_face_traversal.cpp b/example/planar_face_traversal.cpp index e96e9c3b..90ba2a31 100644 --- a/example/planar_face_traversal.cpp +++ b/example/planar_face_traversal.cpp @@ -43,9 +43,8 @@ struct edge_output_visitor : public output_visitor int main(int argc, char** argv) { - typedef adjacency_list< vecS, vecS, undirectedS, - property< vertex_index_t, int >, property< edge_index_t, int > > - graph; + using graph = adjacency_list< vecS, vecS, undirectedS, + property< vertex_index_t, int >, property< edge_index_t, int > >; // Create a graph - this is a biconnected, 3 x 3 grid. // It should have four small (four vertex/four edge) faces and @@ -79,7 +78,7 @@ int main(int argc, char** argv) // Test for planarity - we know it is planar, we just want to // compute the planar embedding as a side-effect - typedef std::vector< graph_traits< graph >::edge_descriptor > vec_t; + using vec_t = std::vector< graph_traits< graph >::edge_descriptor >; std::vector< vec_t > embedding(num_vertices(g)); if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g, boyer_myrvold_params::embedding = &embedding[0])) diff --git a/example/prim-example.cpp b/example/prim-example.cpp index 7136a484..b93daa53 100644 --- a/example/prim-example.cpp +++ b/example/prim-example.cpp @@ -13,10 +13,9 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, undirectedS, - property< vertex_distance_t, int >, property< edge_weight_t, int > > - Graph; - typedef std::pair< int, int > E; + using Graph = adjacency_list< vecS, vecS, undirectedS, + property< vertex_distance_t, int >, property< edge_weight_t, int > >; + using E = std::pair< int, int >; const int num_nodes = 5; const auto edges = { E(0, 2), E(1, 3), E(1, 4), E(2, 1), E(2, 3), E(3, 4), E(4, 0) }; diff --git a/example/prim-telephone.cpp b/example/prim-telephone.cpp index e5dd4df9..ba895a1e 100644 --- a/example/prim-telephone.cpp +++ b/example/prim-telephone.cpp @@ -26,9 +26,8 @@ int main() GraphvizGraph g_dot; read_graphviz("figs/telephone-network.dot", g_dot); - typedef adjacency_list< vecS, vecS, undirectedS, no_property, - property< edge_weight_t, int > > - Graph; + using Graph = adjacency_list< vecS, vecS, undirectedS, no_property, + property< edge_weight_t, int > >; Graph g(num_vertices(g_dot)); auto edge_attr_map = get(edge_attribute, g_dot); graph_traits< GraphvizGraph >::edge_iterator ei, ei_end; @@ -39,7 +38,7 @@ int main() add_edge(source(*ei, g_dot), target(*ei, g_dot), edge_property, g); } - typedef graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = graph_traits< Graph >::vertex_descriptor; std::vector< Vertex > parent(num_vertices(g)); auto weight = get(edge_weight, g); #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 diff --git a/example/print-adjacent-vertices.cpp b/example/print-adjacent-vertices.cpp index 22b0ba65..f1250362 100644 --- a/example/print-adjacent-vertices.cpp +++ b/example/print-adjacent-vertices.cpp @@ -17,7 +17,7 @@ template < typename Graph, typename VertexNamePropertyMap > void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g, VertexNamePropertyMap name_map) { - typedef typename graph_traits< Graph >::vertices_size_type size_type; + using size_type = typename graph_traits< Graph >::vertices_size_type; size_type n_vertices; typename graph_traits< Graph >::vertex_descriptor u; typename property_traits< VertexNamePropertyMap >::value_type name; @@ -76,13 +76,12 @@ inline name_equals_t< NameMap > name_equals( int main(int argc, const char** argv) { - typedef adjacency_list< listS, // Store out-edges of each vertex in a - // std::list + using graph_type = adjacency_list< listS, // Store out-edges of each vertex + // in a std::list vecS, // Store vertex set in a std::vector directedS, // The graph is directed property< vertex_name_t, std::string > // Add a vertex property - > - graph_type; + >; graph_type g; // use default constructor to create empty graph const char* dep_file_name diff --git a/example/print-edges.cpp b/example/print-edges.cpp index 20d4e190..33c1ca2d 100644 --- a/example/print-edges.cpp +++ b/example/print-edges.cpp @@ -17,7 +17,7 @@ template < typename Graph, typename VertexNamePropertyMap > void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g, VertexNamePropertyMap name_map) { - typedef typename graph_traits< Graph >::vertices_size_type size_type; + using size_type = typename graph_traits< Graph >::vertices_size_type; size_type n_vertices; typename graph_traits< Graph >::vertex_descriptor u; typename property_traits< VertexNamePropertyMap >::value_type name; @@ -49,13 +49,12 @@ void print_dependencies( int main(int argc, const char** argv) { - typedef adjacency_list< listS, // Store out-edges of each vertex in a - // std::list + using graph_type = adjacency_list< listS, // Store out-edges of each vertex + // in a std::list vecS, // Store vertex set in a std::vector directedS, // The graph is directed property< vertex_name_t, std::string > // Add a vertex property - > - graph_type; + >; graph_type g; // use default constructor to create empty graph const char* dep_file_name diff --git a/example/print-in-edges.cpp b/example/print-in-edges.cpp index f45ecde1..527d87a0 100644 --- a/example/print-in-edges.cpp +++ b/example/print-in-edges.cpp @@ -17,7 +17,7 @@ template < typename Graph, typename VertexNamePropertyMap > void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g, VertexNamePropertyMap name_map) { - typedef typename graph_traits< Graph >::vertices_size_type size_type; + using size_type = typename graph_traits< Graph >::vertices_size_type; size_type n_vertices; typename graph_traits< Graph >::vertex_descriptor u; typename property_traits< VertexNamePropertyMap >::value_type name; @@ -74,14 +74,13 @@ inline name_equals_t< NameMap > name_equals( int main(int argc, const char** argv) { - typedef adjacency_list< listS, // Store out-edges of each vertex in a - // std::list + using graph_type = adjacency_list< listS, // Store out-edges of each vertex + // in a std::list vecS, // Store vertex set in a std::vector bidirectionalS, // The graph is directed, with both out-edges and // in-edges property< vertex_name_t, std::string > // Add a vertex property - > - graph_type; + >; graph_type g; // use default constructor to create empty graph const char* dep_file_name diff --git a/example/print-out-edges.cpp b/example/print-out-edges.cpp index 8c97205d..a2598dfb 100644 --- a/example/print-out-edges.cpp +++ b/example/print-out-edges.cpp @@ -17,7 +17,7 @@ template < typename Graph, typename VertexNamePropertyMap > void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g, VertexNamePropertyMap name_map) { - typedef typename graph_traits< Graph >::vertices_size_type size_type; + using size_type = typename graph_traits< Graph >::vertices_size_type; size_type n_vertices; typename graph_traits< Graph >::vertex_descriptor u; typename property_traits< VertexNamePropertyMap >::value_type name; @@ -74,13 +74,12 @@ inline name_equals_t< NameMap > name_equals( int main(int argc, const char** argv) { - typedef adjacency_list< listS, // Store out-edges of each vertex in a - // std::list + using graph_type = adjacency_list< listS, // Store out-edges of each vertex + // in a std::list vecS, // Store vertex set in a std::vector directedS, // The graph is directed property< vertex_name_t, std::string > // Add a vertex property - > - graph_type; + >; graph_type g; // use default constructor to create empty graph const char* dep_file_name @@ -107,7 +106,7 @@ int main(int argc, const char** argv) graph_traits< graph_type >::vertex_iterator i, end; boost::tie(i, end) = vertices(g); - typedef property_map< graph_type, vertex_name_t >::type name_map_t; + using name_map_t = property_map< graph_type, vertex_name_t >::type; name_equals_t< name_map_t > predicate("dax.h", get(vertex_name, g)); i = std::find_if(i, end, predicate); output_out_edges(std::cout, g, *i, get(vertex_name, g)); diff --git a/example/property-map-traits-eg.cpp b/example/property-map-traits-eg.cpp index 7c86caac..0ddeee5a 100644 --- a/example/property-map-traits-eg.cpp +++ b/example/property-map-traits-eg.cpp @@ -12,9 +12,8 @@ int main() { using namespace boost; - typedef adjacency_list< listS, listS, directedS, - property< vertex_name_t, std::string > > - graph_t; + using graph_t = adjacency_list< listS, listS, directedS, + property< vertex_name_t, std::string > >; graph_t g; graph_traits< graph_t >::vertex_descriptor u = add_vertex(g); auto name_map = get(vertex_name, g); diff --git a/example/property_iterator.cpp b/example/property_iterator.cpp index 286b81b1..b3f55fd1 100644 --- a/example/property_iterator.cpp +++ b/example/property_iterator.cpp @@ -25,9 +25,9 @@ struct toto_t { num = 23063 }; - typedef vertex_property_tag kind; + using kind = vertex_property_tag; }; -typedef property< toto_t, double > Toto; +using Toto = property< toto_t, double >; struct radius_t { @@ -35,9 +35,9 @@ struct radius_t { num = 23062 }; - typedef vertex_property_tag kind; + using kind = vertex_property_tag; }; -typedef property< radius_t, double, Toto > Radius; +using Radius = property< radius_t, double, Toto >; struct mass_t { @@ -45,9 +45,9 @@ struct mass_t { num = 23061 }; - typedef vertex_property_tag kind; + using kind = vertex_property_tag; }; -typedef property< mass_t, int, Radius > Mass; +using Mass = property< mass_t, int, Radius >; //====== edge properties struct stiff_t @@ -56,16 +56,15 @@ struct stiff_t { num = 23064 }; - typedef edge_property_tag kind; + using kind = edge_property_tag; }; -typedef property< stiff_t, double > Stiff; +using Stiff = property< stiff_t, double >; //===== graph type -typedef Mass VertexProperty; -typedef Stiff EdgeProperty; -typedef adjacency_list< vecS, setS, bidirectionalS, VertexProperty, - EdgeProperty > - Graph; +using VertexProperty = Mass; +using EdgeProperty = Stiff; +using Graph = adjacency_list< vecS, setS, bidirectionalS, VertexProperty, + EdgeProperty >; //===== utilities struct Print diff --git a/example/push-relabel-eg.cpp b/example/push-relabel-eg.cpp index cf146de1..01d0d9eb 100644 --- a/example/push-relabel-eg.cpp +++ b/example/push-relabel-eg.cpp @@ -47,13 +47,12 @@ int main() { using namespace boost; - typedef adjacency_list_traits< vecS, vecS, directedS > Traits; - typedef adjacency_list< vecS, vecS, directedS, + using Traits = adjacency_list_traits< vecS, vecS, directedS >; + using Graph = adjacency_list< vecS, vecS, directedS, property< vertex_name_t, std::string >, property< edge_capacity_t, long, property< edge_residual_capacity_t, long, - property< edge_reverse_t, Traits::edge_descriptor > > > > - Graph; + property< edge_reverse_t, Traits::edge_descriptor > > > >; Graph g; auto capacity = get(edge_capacity, g); diff --git a/example/put-get-helper-eg.cpp b/example/put-get-helper-eg.cpp index ae736ba1..c0950453 100644 --- a/example/put-get-helper-eg.cpp +++ b/example/put-get-helper-eg.cpp @@ -24,12 +24,12 @@ class iterator_property_map iterator_property_map< RandomAccessIterator, IndexMap > > { public: - typedef std::ptrdiff_t key_type; - typedef typename std::iterator_traits< RandomAccessIterator >::value_type - value_type; - typedef typename std::iterator_traits< RandomAccessIterator >::reference - reference; - typedef boost::lvalue_property_map_tag category; + using key_type = std::ptrdiff_t; + using value_type = + typename std::iterator_traits< RandomAccessIterator >::value_type; + using reference = + typename std::iterator_traits< RandomAccessIterator >::reference; + using category = boost::lvalue_property_map_tag; iterator_property_map(RandomAccessIterator cc = RandomAccessIterator(), const IndexMap& _id = IndexMap()) @@ -50,10 +50,9 @@ protected: int main() { - typedef std::vector< std::string > vec_t; - typedef foo::iterator_property_map< vec_t::iterator, - boost::identity_property_map > - pmap_t; + using vec_t = std::vector< std::string >; + using pmap_t = foo::iterator_property_map< vec_t::iterator, + boost::identity_property_map >; using namespace boost; BOOST_CONCEPT_ASSERT((Mutable_LvaluePropertyMapConcept< pmap_t, int >)); return 0; diff --git a/example/quick-tour.cpp b/example/quick-tour.cpp index 85f3c518..63cb561f 100644 --- a/example/quick-tour.cpp +++ b/example/quick-tour.cpp @@ -31,7 +31,7 @@ template < typename Graph, typename VertexNameMap > void print_vertex_names(const Graph& g, VertexNameMap name_map) { std::cout << "vertices(g) = { "; - typedef typename graph_traits< Graph >::vertex_iterator iter_t; + using iter_t = typename graph_traits< Graph >::vertex_iterator; for (auto p = vertices(g); p.first != p.second; ++p.first) { print_vertex_name(*p.first, name_map); @@ -89,9 +89,8 @@ void build_router_network( int main() { - typedef adjacency_list< listS, listS, directedS, - property< vertex_name_t, char >, property< edge_weight_t, double > > - graph_t; + using graph_t = adjacency_list< listS, listS, directedS, + property< vertex_name_t, char >, property< edge_weight_t, double > >; graph_t g; auto name_map = get(vertex_name, g); diff --git a/example/quick_tour.cpp b/example/quick_tour.cpp index f952c976..25369663 100644 --- a/example/quick_tour.cpp +++ b/example/quick_tour.cpp @@ -20,7 +20,7 @@ using namespace boost; template < class Graph > struct exercise_vertex { exercise_vertex(Graph& g_, const char name_[]) : g(g_), name(name_) {} - typedef typename graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = typename graph_traits< Graph >::vertex_descriptor; void operator()(const Vertex& v) const { using namespace boost; @@ -67,10 +67,9 @@ template < class Graph > struct exercise_vertex int main(int, char*[]) { - // create a typedef for the Graph type - typedef adjacency_list< vecS, vecS, bidirectionalS, no_property, - property< edge_weight_t, float > > - Graph; + // create an alias for the Graph type + using Graph = adjacency_list< vecS, vecS, bidirectionalS, no_property, + property< edge_weight_t, float > >; // Make convenient labels for the vertices enum @@ -86,7 +85,7 @@ int main(int, char*[]) const char name[] = "ABCDE"; // writing out the edges in the graph - typedef std::pair< int, int > Edge; + using Edge = std::pair< int, int >; Edge edge_array[] = { Edge(A, B), Edge(A, D), @@ -125,7 +124,7 @@ int main(int, char*[]) = get(edge_weight, g); std::cout << "vertices(g) = "; - typedef graph_traits< Graph >::vertex_iterator vertex_iter; + using vertex_iter = graph_traits< Graph >::vertex_iterator; std::pair< vertex_iter, vertex_iter > vp; for (vp = vertices(g); vp.first != vp.second; ++vp.first) std::cout << name[get(vertex_id, *vp.first)] << " "; diff --git a/example/r_c_shortest_paths_example.cpp b/example/r_c_shortest_paths_example.cpp index 747481f5..77326bb7 100644 --- a/example/r_c_shortest_paths_example.cpp +++ b/example/r_c_shortest_paths_example.cpp @@ -43,9 +43,8 @@ struct SPPRC_Example_Graph_Arc_Prop int time; }; -typedef adjacency_list< vecS, vecS, directedS, SPPRC_Example_Graph_Vert_Prop, - SPPRC_Example_Graph_Arc_Prop > - SPPRC_Example_Graph; +using SPPRC_Example_Graph = adjacency_list< vecS, vecS, directedS, + SPPRC_Example_Graph_Vert_Prop, SPPRC_Example_Graph_Arc_Prop >; // data structures for spp without resource constraints: // ResourceContainer model diff --git a/example/reachable-loop-head.cpp b/example/reachable-loop-head.cpp index aa05ab0a..6c4b40f4 100644 --- a/example/reachable-loop-head.cpp +++ b/example/reachable-loop-head.cpp @@ -33,7 +33,7 @@ int main(int argc, char* argv[]) GraphvizDigraph g; read_graphviz(argv[1], g); graph_traits< GraphvizDigraph >::vertex_descriptor loop_head = 1; - typedef color_traits< default_color_type > Color; + using Color = color_traits< default_color_type >; std::vector< default_color_type > reachable_from_head( num_vertices(g), Color::white()); diff --git a/example/reachable-loop-tail.cpp b/example/reachable-loop-tail.cpp index 2d9f3dd3..c49f9847 100644 --- a/example/reachable-loop-tail.cpp +++ b/example/reachable-loop-tail.cpp @@ -34,14 +34,13 @@ int main(int argc, char* argv[]) GraphvizDigraph g_in; read_graphviz(argv[1], g_in); - typedef adjacency_list< vecS, vecS, bidirectionalS, GraphvizVertexProperty, - GraphvizEdgeProperty, GraphvizGraphProperty > - Graph; + using Graph = adjacency_list< vecS, vecS, bidirectionalS, + GraphvizVertexProperty, GraphvizEdgeProperty, GraphvizGraphProperty >; Graph g; copy_graph(g_in, g); graph_traits< GraphvizDigraph >::vertex_descriptor loop_tail = 6; - typedef color_traits< default_color_type > Color; + using Color = color_traits< default_color_type >; default_color_type c; std::vector< default_color_type > reachable_to_tail(num_vertices(g)); diff --git a/example/read_graphviz.cpp b/example/read_graphviz.cpp index 3b6348a4..36b3a1f0 100644 --- a/example/read_graphviz.cpp +++ b/example/read_graphviz.cpp @@ -20,16 +20,15 @@ using namespace std; int main() { // Vertex properties - typedef property< vertex_name_t, std::string, - property< vertex_color_t, float > > - vertex_p; + using vertex_p = property< vertex_name_t, std::string, + property< vertex_color_t, float > >; // Edge properties - typedef property< edge_weight_t, double > edge_p; + using edge_p = property< edge_weight_t, double >; // Graph properties - typedef property< graph_name_t, std::string > graph_p; + using graph_p = property< graph_name_t, std::string >; // adjacency_list-based type - typedef adjacency_list< vecS, vecS, directedS, vertex_p, edge_p, graph_p > - graph_t; + using graph_t + = adjacency_list< vecS, vecS, directedS, vertex_p, edge_p, graph_p >; // Construct an empty graph and prepare the dynamic_property_maps. graph_t graph(0); diff --git a/example/read_write_dimacs-eg.cpp b/example/read_write_dimacs-eg.cpp index 9d7f670c..3ebddc79 100644 --- a/example/read_write_dimacs-eg.cpp +++ b/example/read_write_dimacs-eg.cpp @@ -63,20 +63,19 @@ template < typename EdgeCapacityMap > struct zero_edge_capacity int main() { using namespace boost; - typedef adjacency_list_traits< vecS, vecS, directedS > Traits; - typedef adjacency_list< vecS, vecS, directedS, no_property, + using Traits = adjacency_list_traits< vecS, vecS, directedS >; + using Graph = adjacency_list< vecS, vecS, directedS, no_property, property< edge_capacity_t, long, - property< edge_reverse_t, Traits::edge_descriptor > > > - Graph; + property< edge_reverse_t, Traits::edge_descriptor > > >; - typedef graph_traits< Graph >::out_edge_iterator out_edge_iterator; - typedef graph_traits< Graph >::edge_descriptor edge_descriptor; - typedef graph_traits< Graph >::vertex_descriptor vertex_descriptor; + using out_edge_iterator = graph_traits< Graph >::out_edge_iterator; + using edge_descriptor = graph_traits< Graph >::edge_descriptor; + using vertex_descriptor = graph_traits< Graph >::vertex_descriptor; Graph g; - typedef property_map< Graph, edge_capacity_t >::type tCapMap; - typedef tCapMap::value_type tCapMapValue; + using tCapMap = property_map< Graph, edge_capacity_t >::type; + using tCapMapValue = tCapMap::value_type; auto capacity = get(edge_capacity, g); auto rev = get(edge_reverse, g); diff --git a/example/remove_edge_if_bidir.cpp b/example/remove_edge_if_bidir.cpp index 9be499fd..76b8044a 100644 --- a/example/remove_edge_if_bidir.cpp +++ b/example/remove_edge_if_bidir.cpp @@ -40,9 +40,8 @@ using namespace boost; -typedef adjacency_list< vecS, vecS, bidirectionalS, no_property, - property< edge_weight_t, int > > - Graph; +using Graph = adjacency_list< vecS, vecS, bidirectionalS, no_property, + property< edge_weight_t, int > >; struct has_weight_greater_than { @@ -63,7 +62,7 @@ struct has_weight_greater_than int main() { - typedef std::pair< std::size_t, std::size_t > Edge; + using Edge = std::pair< std::size_t, std::size_t >; Edge edge_array[6] = { Edge(0, 3), Edge(0, 2), Edge(0, 3), Edge(1, 3), Edge(2, 0), Edge(3, 2) }; diff --git a/example/remove_edge_if_dir.cpp b/example/remove_edge_if_dir.cpp index 534f83f9..411ba84f 100644 --- a/example/remove_edge_if_dir.cpp +++ b/example/remove_edge_if_dir.cpp @@ -36,11 +36,11 @@ using namespace boost; -typedef adjacency_list< vecS, vecS, directedS > Graph; +using Graph = adjacency_list< vecS, vecS, directedS >; int main() { - typedef std::pair< std::size_t, std::size_t > Edge; + using Edge = std::pair< std::size_t, std::size_t >; const auto edges = { Edge(0, 3), Edge(0, 2), Edge(0, 3), Edge(1, 3), Edge(2, 0), Edge(3, 2) }; diff --git a/example/remove_edge_if_undir.cpp b/example/remove_edge_if_undir.cpp index 0d5f49b3..cb0cc82d 100644 --- a/example/remove_edge_if_undir.cpp +++ b/example/remove_edge_if_undir.cpp @@ -39,9 +39,8 @@ using namespace boost; */ -typedef adjacency_list< vecS, vecS, undirectedS, no_property, - property< edge_weight_t, int > > - Graph; +using Graph = adjacency_list< vecS, vecS, undirectedS, no_property, + property< edge_weight_t, int > >; struct has_weight_greater_than { @@ -62,7 +61,7 @@ struct has_weight_greater_than int main() { - typedef std::pair< std::size_t, std::size_t > Edge; + using Edge = std::pair< std::size_t, std::size_t >; Edge edge_array[5] = { Edge(0, 3), Edge(0, 3), Edge(1, 3), Edge(2, 0), Edge(3, 2) }; diff --git a/example/reverse_graph.cpp b/example/reverse_graph.cpp index be840bd0..fb5531b9 100644 --- a/example/reverse_graph.cpp +++ b/example/reverse_graph.cpp @@ -19,7 +19,7 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, bidirectionalS > Graph; + using Graph = adjacency_list< vecS, vecS, bidirectionalS >; Graph G(5); add_edge(0, 2, G); diff --git a/example/roget_components.cpp b/example/roget_components.cpp index a90b1a9d..d3c12c43 100644 --- a/example/roget_components.cpp +++ b/example/roget_components.cpp @@ -19,7 +19,7 @@ int main(int argc, char* argv[]) { using namespace boost; Graph* g; - typedef graph_traits< Graph* >::vertex_descriptor vertex_t; + using vertex_t = graph_traits< Graph* >::vertex_descriptor; unsigned long n = 0; unsigned long d = 0; unsigned long p = 0; diff --git a/example/scaled_closeness_centrality.cpp b/example/scaled_closeness_centrality.cpp index 1f349f68..ae20c426 100644 --- a/example/scaled_closeness_centrality.cpp +++ b/example/scaled_closeness_centrality.cpp @@ -27,8 +27,8 @@ template < typename Graph, typename Distance, typename Result, typename Divide = divides< Result > > struct scaled_closeness_measure { - typedef Distance distance_type; - typedef Result result_type; + using distance_type = Distance; + using result_type = Result; Result operator()(Distance d, const Graph& g) { @@ -51,29 +51,29 @@ struct Actor }; // Declare the graph type and its vertex and edge types. -typedef undirected_graph< Actor > Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = undirected_graph< Actor >; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; // The name map provides an abstract accessor for the names of // each vertex. This is used during graph creation. -typedef property_map< Graph, string Actor::* >::type NameMap; +using NameMap = property_map< Graph, string Actor::* >::type; // Declare a matrix type and its corresponding property map that // will contain the distances between each pair of vertices. -typedef exterior_vertex_property< Graph, int > DistanceProperty; -typedef DistanceProperty::matrix_type DistanceMatrix; -typedef DistanceProperty::matrix_map_type DistanceMatrixMap; +using DistanceProperty = exterior_vertex_property< Graph, int >; +using DistanceMatrix = DistanceProperty::matrix_type; +using DistanceMatrixMap = DistanceProperty::matrix_map_type; // Declare the weight map so that each edge returns the same value. -typedef constant_property_map< Edge, int > WeightMap; +using WeightMap = constant_property_map< Edge, int >; // Declare a container and its corresponding property map that // will contain the resulting closeness centralities of each // vertex in the graph. -typedef boost::exterior_vertex_property< Graph, float > ClosenessProperty; -typedef ClosenessProperty::container_type ClosenessContainer; -typedef ClosenessProperty::map_type ClosenessMap; +using ClosenessProperty = boost::exterior_vertex_property< Graph, float >; +using ClosenessContainer = ClosenessProperty::container_type; +using ClosenessMap = ClosenessProperty::map_type; int main(int argc, char* argv[]) { diff --git a/example/scc.cpp b/example/scc.cpp index 94dc7d08..d53765ef 100644 --- a/example/scc.cpp +++ b/example/scc.cpp @@ -26,7 +26,7 @@ int main() GraphvizDigraph g; read_graphviz("figs/scc.dot", g); - typedef graph_traits< GraphvizDigraph >::vertex_descriptor vertex_t; + using vertex_t = graph_traits< GraphvizDigraph >::vertex_descriptor; std::map< vertex_t, int > component; strong_components(g, make_assoc_property_map(component)); diff --git a/example/simple_planarity_test.cpp b/example/simple_planarity_test.cpp index cb67452a..3d345b82 100644 --- a/example/simple_planarity_test.cpp +++ b/example/simple_planarity_test.cpp @@ -17,9 +17,8 @@ int main(int argc, char** argv) using namespace boost; - typedef adjacency_list< vecS, vecS, undirectedS, - property< vertex_index_t, int > > - graph; + using graph = adjacency_list< vecS, vecS, undirectedS, + property< vertex_index_t, int > >; graph K_4(4); add_edge(0, 1, K_4); diff --git a/example/sloan_ordering.cpp b/example/sloan_ordering.cpp index f3b98d1e..0fe43d56 100644 --- a/example/sloan_ordering.cpp +++ b/example/sloan_ordering.cpp @@ -71,16 +71,15 @@ int main(int, char*[]) using namespace std; // Defining the graph type - typedef adjacency_list< setS, vecS, undirectedS, + using Graph = adjacency_list< setS, vecS, undirectedS, property< vertex_color_t, default_color_type, property< vertex_degree_t, int, - property< vertex_priority_t, double > > > > - Graph; + property< vertex_priority_t, double > > > >; - typedef graph_traits< Graph >::vertex_descriptor Vertex; - typedef graph_traits< Graph >::vertices_size_type size_type; + using Vertex = graph_traits< Graph >::vertex_descriptor; + using size_type = graph_traits< Graph >::vertices_size_type; - typedef std::pair< std::size_t, std::size_t > Pair; + using Pair = std::pair< std::size_t, std::size_t >; Pair edges[14] = { Pair(0, 3), // a-d Pair(0, 5), // a-f diff --git a/example/stoer_wagner.cpp b/example/stoer_wagner.cpp index 54a2c25c..56762835 100644 --- a/example/stoer_wagner.cpp +++ b/example/stoer_wagner.cpp @@ -26,12 +26,12 @@ int main() { using namespace std; - typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, - boost::no_property, boost::property< boost::edge_weight_t, int > > - undirected_graph; - typedef boost::property_map< undirected_graph, boost::edge_weight_t >::type - weight_map_type; - typedef boost::property_traits< weight_map_type >::value_type weight_type; + using undirected_graph + = boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, + boost::no_property, boost::property< boost::edge_weight_t, int > >; + using weight_map_type + = boost::property_map< undirected_graph, boost::edge_weight_t >::type; + using weight_type = boost::property_traits< weight_map_type >::value_type; // define the 16 edges of the graph. {3, 4} means an undirected edge between // vertices 3 and 4. diff --git a/example/straight_line_drawing.cpp b/example/straight_line_drawing.cpp index b76bb4ab..a425738a 100644 --- a/example/straight_line_drawing.cpp +++ b/example/straight_line_drawing.cpp @@ -28,16 +28,15 @@ struct coord_t int main(int argc, char** argv) { - typedef adjacency_list< vecS, vecS, undirectedS, - property< vertex_index_t, int > > - graph; + using graph = adjacency_list< vecS, vecS, undirectedS, + property< vertex_index_t, int > >; // Define the storage type for the planar embedding - typedef std::vector< std::vector< graph_traits< graph >::edge_descriptor > > - embedding_storage_t; - typedef boost::iterator_property_map< embedding_storage_t::iterator, - property_map< graph, vertex_index_t >::type > - embedding_t; + using embedding_storage_t + = std::vector< std::vector< graph_traits< graph >::edge_descriptor > >; + using embedding_t + = boost::iterator_property_map< embedding_storage_t::iterator, + property_map< graph, vertex_index_t >::type >; // Create the graph - a maximal planar graph on 7 vertices. The functions // planar_canonical_ordering and chrobak_payne_straight_line_drawing both @@ -76,11 +75,10 @@ int main(int argc, char** argv) planar_canonical_ordering(g, embedding, std::back_inserter(ordering)); // Set up a property map to hold the mapping from vertices to coord_t's - typedef std::vector< coord_t > straight_line_drawing_storage_t; - typedef boost::iterator_property_map< + using straight_line_drawing_storage_t = std::vector< coord_t >; + using straight_line_drawing_t = boost::iterator_property_map< straight_line_drawing_storage_t::iterator, - property_map< graph, vertex_index_t >::type > - straight_line_drawing_t; + property_map< graph, vertex_index_t >::type >; straight_line_drawing_storage_t straight_line_drawing_storage( num_vertices(g)); diff --git a/example/strong-components.cpp b/example/strong-components.cpp index 4e5d876b..05a86709 100644 --- a/example/strong-components.cpp +++ b/example/strong-components.cpp @@ -14,7 +14,7 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, directedS > Graph; + using Graph = adjacency_list< vecS, vecS, directedS >; const int N = 6; Graph G(N); add_edge(0, 1, G); diff --git a/example/strong_components.cpp b/example/strong_components.cpp index 2b1e1b13..a5d1fcc7 100644 --- a/example/strong_components.cpp +++ b/example/strong_components.cpp @@ -61,8 +61,8 @@ int main(int, char*[]) print_graph(G, name); std::cout << std::endl; - typedef graph_traits< - adjacency_list< vecS, vecS, directedS > >::vertex_descriptor Vertex; + using Vertex = graph_traits< + adjacency_list< vecS, vecS, directedS > >::vertex_descriptor; std::vector< int > component(num_vertices(G)), discover_time(num_vertices(G)); diff --git a/example/subgraph.cpp b/example/subgraph.cpp index 36fa274b..f0147364 100644 --- a/example/subgraph.cpp +++ b/example/subgraph.cpp @@ -41,9 +41,8 @@ int main(int, char*[]) { using namespace boost; - typedef subgraph< adjacency_list< vecS, vecS, directedS, - property< vertex_color_t, int >, property< edge_index_t, int > > > - Graph; + using Graph = subgraph< adjacency_list< vecS, vecS, directedS, + property< vertex_color_t, int >, property< edge_index_t, int > > >; const int N = 6; Graph G0(N); diff --git a/example/subgraph_properties.cpp b/example/subgraph_properties.cpp index 17d217f8..91f9fcf1 100644 --- a/example/subgraph_properties.cpp +++ b/example/subgraph_properties.cpp @@ -38,15 +38,13 @@ int main(int, char*[]) { using namespace boost; - // typedef adjacency_list_traits Traits;// Does + // using Traits = adjacency_list_traits;// Does // nothing? - typedef property< vertex_color_t, int, - property< vertex_name_t, std::string > > - VertexProperty; + using VertexProperty = property< vertex_color_t, int, + property< vertex_name_t, std::string > >; - typedef subgraph< adjacency_list< vecS, vecS, directedS, VertexProperty, - property< edge_index_t, int > > > - Graph; + using Graph = subgraph< adjacency_list< vecS, vecS, directedS, + VertexProperty, property< edge_index_t, int > > >; const int N = 6; Graph G0(N); diff --git a/example/tiernan_girth_circumference.cpp b/example/tiernan_girth_circumference.cpp index a2c36d3e..81ab70ab 100644 --- a/example/tiernan_girth_circumference.cpp +++ b/example/tiernan_girth_circumference.cpp @@ -16,9 +16,9 @@ using namespace std; using namespace boost; // Declare the graph type and its vertex and edge types. -typedef directed_graph<> Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = directed_graph<>; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; int main(int argc, char* argv[]) { diff --git a/example/tiernan_print_cycles.cpp b/example/tiernan_print_cycles.cpp index e07c53fa..a0f11023 100644 --- a/example/tiernan_print_cycles.cpp +++ b/example/tiernan_print_cycles.cpp @@ -42,9 +42,9 @@ template < typename OutputStream > struct cycle_printer }; // Declare the graph type and its vertex and edge types. -typedef directed_graph<> Graph; -typedef graph_traits< Graph >::vertex_descriptor Vertex; -typedef graph_traits< Graph >::edge_descriptor Edge; +using Graph = directed_graph<>; +using Vertex = graph_traits< Graph >::vertex_descriptor; +using Edge = graph_traits< Graph >::edge_descriptor; int main(int argc, char* argv[]) { diff --git a/example/topo-sort-file-dep.cpp b/example/topo-sort-file-dep.cpp index 6607e7e9..d70a1d54 100644 --- a/example/topo-sort-file-dep.cpp +++ b/example/topo-sort-file-dep.cpp @@ -24,14 +24,14 @@ std::istream& operator>>(std::istream& in, std::pair< T, T >& p) } } -typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list - vecS, // Store vertex set in a std::vector - directedS // The file dependency graph is directed - > - file_dep_graph; +using file_dep_graph + = adjacency_list< listS, // Store out-edges of each vertex in a std::list + vecS, // Store vertex set in a std::vector + directedS // The file dependency graph is directed + >; -typedef graph_traits< file_dep_graph >::vertex_descriptor vertex_t; -typedef graph_traits< file_dep_graph >::edge_descriptor edge_t; +using vertex_t = graph_traits< file_dep_graph >::vertex_descriptor; +using edge_t = graph_traits< file_dep_graph >::edge_descriptor; void topo_sort_dfs( const file_dep_graph& g, vertex_t u, vertex_t*& topo_order, int* mark) @@ -57,7 +57,7 @@ void topo_sort(const file_dep_graph& g, vertex_t* topo_order) int main(int argc, const char** argv) { std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"); - typedef graph_traits< file_dep_graph >::vertices_size_type size_type; + using size_type = graph_traits< file_dep_graph >::vertices_size_type; size_type n_vertices; file_in >> n_vertices; // read in number of vertices std::istream_iterator< std::pair< size_type, size_type > > input_begin( diff --git a/example/topo-sort-file-dep2.cpp b/example/topo-sort-file-dep2.cpp index 68304b3f..e76e4d6f 100644 --- a/example/topo-sort-file-dep2.cpp +++ b/example/topo-sort-file-dep2.cpp @@ -24,14 +24,14 @@ std::istream& operator>>(std::istream& in, std::pair< T, T >& p) } } -typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list - vecS, // Store vertex set in a std::vector - directedS // The file dependency graph is directed - > - file_dep_graph; +using file_dep_graph + = adjacency_list< listS, // Store out-edges of each vertex in a std::list + vecS, // Store vertex set in a std::vector + directedS // The file dependency graph is directed + >; -typedef graph_traits< file_dep_graph >::vertex_descriptor vertex_t; -typedef graph_traits< file_dep_graph >::edge_descriptor edge_t; +using vertex_t = graph_traits< file_dep_graph >::vertex_descriptor; +using edge_t = graph_traits< file_dep_graph >::edge_descriptor; template < typename Visitor > void dfs_v1( @@ -99,7 +99,7 @@ void topo_sort(const file_dep_graph& g, vertex_t* topo_order) int main(int argc, const char** argv) { std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat"); - typedef graph_traits< file_dep_graph >::vertices_size_type size_type; + using size_type = graph_traits< file_dep_graph >::vertices_size_type; size_type n_vertices; file_in >> n_vertices; // read in number of vertices std::istream_iterator< std::pair< size_type, size_type > > input_begin( diff --git a/example/topo-sort-with-leda.cpp b/example/topo-sort-with-leda.cpp index d4120b69..0b2b46eb 100644 --- a/example/topo-sort-with-leda.cpp +++ b/example/topo-sort-with-leda.cpp @@ -16,9 +16,9 @@ int main() { using namespace boost; - typedef GRAPH< std::string, char > graph_t; + using graph_t = GRAPH< std::string, char >; graph_t leda_g; - typedef graph_traits< graph_t >::vertex_descriptor vertex_t; + using vertex_t = graph_traits< graph_t >::vertex_descriptor; std::vector< vertex_t > vert(7); vert[0] = add_vertex(std::string("pick up kids from school"), leda_g); vert[1] = add_vertex(std::string("buy groceries (and snacks)"), leda_g); diff --git a/example/topo-sort-with-sgb.cpp b/example/topo-sort-with-sgb.cpp index eb43a89f..a060792a 100644 --- a/example/topo-sort-with-sgb.cpp +++ b/example/topo-sort-with-sgb.cpp @@ -31,7 +31,7 @@ int main() gb_new_arc(sgb_g->vertices + 4, sgb_g->vertices + 6, 0); gb_new_arc(sgb_g->vertices + 5, sgb_g->vertices + 6, 0); - typedef graph_traits< Graph* >::vertex_descriptor vertex_t; + using vertex_t = graph_traits< Graph* >::vertex_descriptor; std::vector< vertex_t > topo_order; topological_sort(sgb_g, std::back_inserter(topo_order), vertex_index_map(get(vertex_index, sgb_g))); diff --git a/example/topo_sort.cpp b/example/topo_sort.cpp index 398814a4..8346155f 100644 --- a/example/topo_sort.cpp +++ b/example/topo_sort.cpp @@ -15,7 +15,7 @@ #include #include -typedef std::pair< std::size_t, std::size_t > Pair; +using Pair = std::pair< std::size_t, std::size_t >; /* Topological sort example @@ -38,11 +38,10 @@ int main(int, char*[]) /* Topological sort will need to color the graph. Here we use an internal decorator, so we "property" the color to the graph. */ - typedef adjacency_list< vecS, vecS, directedS, - property< vertex_color_t, default_color_type > > - Graph; + using Graph = adjacency_list< vecS, vecS, directedS, + property< vertex_color_t, default_color_type > >; - typedef boost::graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = boost::graph_traits< Graph >::vertex_descriptor; const auto edges = { Pair(0, 1), Pair(2, 4), Pair(2, 5), Pair(0, 3), Pair(1, 4), Pair(4, 3) }; @@ -50,7 +49,7 @@ int main(int, char*[]) auto id = get(vertex_index, G); - typedef std::vector< Vertex > container; + using container = std::vector< Vertex >; container c; topological_sort(G, std::back_inserter(c)); diff --git a/example/transitive_closure.cpp b/example/transitive_closure.cpp index 1699071e..4fb8cda6 100644 --- a/example/transitive_closure.cpp +++ b/example/transitive_closure.cpp @@ -17,10 +17,10 @@ int main(int, char*[]) { using namespace boost; - typedef property< vertex_name_t, char > Name; - typedef property< vertex_index_t, std::size_t, Name > Index; - typedef adjacency_list< listS, listS, directedS, Index > graph_t; - typedef graph_traits< graph_t >::vertex_descriptor vertex_t; + using Name = property< vertex_name_t, char >; + using Index = property< vertex_index_t, std::size_t, Name >; + using graph_t = adjacency_list< listS, listS, directedS, Index >; + using vertex_t = graph_traits< graph_t >::vertex_descriptor; graph_t G; std::vector< vertex_t > verts(4); for (int i = 0; i < 4; ++i) diff --git a/example/transpose-example.cpp b/example/transpose-example.cpp index 3f7d8fe1..6f3acd5f 100644 --- a/example/transpose-example.cpp +++ b/example/transpose-example.cpp @@ -14,9 +14,8 @@ int main() { using namespace boost; - typedef adjacency_list< vecS, vecS, bidirectionalS, - property< vertex_name_t, char > > - graph_t; + using graph_t = adjacency_list< vecS, vecS, bidirectionalS, + property< vertex_name_t, char > >; enum { @@ -36,7 +35,7 @@ int main() for (boost::tie(v, v_end) = vertices(G); v != v_end; ++v, ++name) name_map[*v] = name; - typedef std::pair< int, int > E; + using E = std::pair< int, int >; E edge_array[] = { E(a, c), E(a, d), E(b, a), E(b, d), E(c, f), E(d, c), E(d, e), E(d, f), E(e, b), E(e, g), E(f, e), E(f, g) }; for (int i = 0; i < 12; ++i) diff --git a/example/two_graphs_common_spanning_trees.cpp b/example/two_graphs_common_spanning_trees.cpp index 0a209bf4..95c16117 100644 --- a/example/two_graphs_common_spanning_trees.cpp +++ b/example/two_graphs_common_spanning_trees.cpp @@ -15,23 +15,22 @@ using namespace std; -typedef boost::adjacency_list< boost::vecS, // OutEdgeList +using Graph = boost::adjacency_list< boost::vecS, // OutEdgeList boost::vecS, // VertexList boost::undirectedS, // Directed boost::no_property, // VertexProperties boost::no_property, // EdgeProperties boost::no_property, // GraphProperties boost::listS // EdgeList - > - Graph; + >; -typedef boost::graph_traits< Graph >::vertex_descriptor vertex_descriptor; +using vertex_descriptor = boost::graph_traits< Graph >::vertex_descriptor; -typedef boost::graph_traits< Graph >::edge_descriptor edge_descriptor; +using edge_descriptor = boost::graph_traits< Graph >::edge_descriptor; -typedef boost::graph_traits< Graph >::vertex_iterator vertex_iterator; +using vertex_iterator = boost::graph_traits< Graph >::vertex_iterator; -typedef boost::graph_traits< Graph >::edge_iterator edge_iterator; +using edge_iterator = boost::graph_traits< Graph >::edge_iterator; int main(int argc, char** argv) { diff --git a/example/undirected_adjacency_list.cpp b/example/undirected_adjacency_list.cpp index 4836d50e..4ac04c8a 100644 --- a/example/undirected_adjacency_list.cpp +++ b/example/undirected_adjacency_list.cpp @@ -38,7 +38,7 @@ template < typename DirectedGraph > void directed_graph_demo() { const int V = 2; DirectedGraph digraph(V); - typedef typename DirectedGraph::edge_property_type Weight; + using Weight = typename DirectedGraph::edge_property_type; auto weight = get(edge_weight, digraph); typename graph_traits< DirectedGraph >::edge_descriptor e1, e2; bool found; @@ -65,7 +65,7 @@ template < typename UndirectedGraph > void undirected_graph_demo2() { const int V = 2; UndirectedGraph undigraph(V); - typedef typename UndirectedGraph::edge_property_type Weight; + using Weight = typename UndirectedGraph::edge_property_type; typename property_map< UndirectedGraph, edge_weight_t >::type weight = get(edge_weight, undigraph); typename graph_traits< UndirectedGraph >::edge_descriptor e1, e2; @@ -96,11 +96,11 @@ template < typename UndirectedGraph > void undirected_graph_demo2() int main() { - typedef property< edge_weight_t, double > Weight; - typedef adjacency_list< vecS, vecS, undirectedS, no_property, Weight > - UndirectedGraph; - typedef adjacency_list< vecS, vecS, directedS, no_property, Weight > - DirectedGraph; + using Weight = property< edge_weight_t, double >; + using UndirectedGraph + = adjacency_list< vecS, vecS, undirectedS, no_property, Weight >; + using DirectedGraph + = adjacency_list< vecS, vecS, directedS, no_property, Weight >; undirected_graph_demo1< UndirectedGraph >(); directed_graph_demo< DirectedGraph >(); undirected_graph_demo2< UndirectedGraph >(); diff --git a/example/undirected_dfs.cpp b/example/undirected_dfs.cpp index 05ce6e7a..d0a9363b 100644 --- a/example/undirected_dfs.cpp +++ b/example/undirected_dfs.cpp @@ -42,10 +42,9 @@ struct detect_loops : public boost::dfs_visitor<> int main(int, char*[]) { using namespace boost; - typedef adjacency_list< vecS, vecS, undirectedS, no_property, - property< edge_color_t, default_color_type > > - graph_t; - typedef graph_traits< graph_t >::vertex_descriptor vertex_t; + using graph_t = adjacency_list< vecS, vecS, undirectedS, no_property, + property< edge_color_t, default_color_type > >; + using vertex_t = graph_traits< graph_t >::vertex_descriptor; const std::size_t N = sizeof(name) / sizeof(std::string); graph_t g(N); diff --git a/example/undirected_graph.cpp b/example/undirected_graph.cpp index 3fa2847c..8ca26546 100644 --- a/example/undirected_graph.cpp +++ b/example/undirected_graph.cpp @@ -10,7 +10,7 @@ #include #include -typedef boost::undirected_graph< boost::no_property > Graph; +using Graph = boost::undirected_graph< boost::no_property >; int main(int, char*[]) { diff --git a/example/vector_as_graph.cpp b/example/vector_as_graph.cpp index 0000a0fc..910ffe79 100644 --- a/example/vector_as_graph.cpp +++ b/example/vector_as_graph.cpp @@ -30,7 +30,7 @@ int main() y }; char name[] = "rstuvwxy"; - typedef std::vector< std::list< int > > Graph; + using Graph = std::vector< std::list< int > >; Graph g = { { v }, // r { r, r, w }, // s { x }, // t diff --git a/example/vertex-name-property.cpp b/example/vertex-name-property.cpp index 0971334c..fe4bf4fa 100644 --- a/example/vertex-name-property.cpp +++ b/example/vertex-name-property.cpp @@ -17,7 +17,7 @@ template < typename Graph, typename VertexNamePropertyMap > void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g, VertexNamePropertyMap name_map) { - typedef typename graph_traits< Graph >::vertices_size_type size_type; + using size_type = typename graph_traits< Graph >::vertices_size_type; size_type n_vertices; typename graph_traits< Graph >::vertex_descriptor u; typename property_traits< VertexNamePropertyMap >::value_type name; @@ -39,13 +39,12 @@ void read_graph_file(std::istream& graph_in, std::istream& name_in, Graph& g, int main(int argc, const char** argv) { - typedef adjacency_list< listS, // Store out-edges of each vertex in a - // std::list + using graph_type = adjacency_list< listS, // Store out-edges of each vertex + // in a std::list vecS, // Store vertex set in a std::vector directedS, // The graph is directed property< vertex_name_t, std::string > // Add a vertex property - > - graph_type; + >; graph_type g; // use default constructor to create empty graph const char* dep_file_name @@ -73,9 +72,8 @@ int main(int argc, const char** argv) // Create storage for last modified times std::vector< time_t > last_mod_vec(num_vertices(g)); // Create nickname for the property map type - typedef iterator_property_map< std::vector< time_t >::iterator, - property_map< graph_type, vertex_index_t >::type, time_t, time_t& > - iter_map_t; + using iter_map_t = iterator_property_map< std::vector< time_t >::iterator, + property_map< graph_type, vertex_index_t >::type, time_t, time_t& >; // Create last modified time property map iter_map_t mod_time_map(last_mod_vec.begin(), get(vertex_index, g)); diff --git a/example/vertex_basics.cpp b/example/vertex_basics.cpp index 4cbc0bf3..ded11e67 100644 --- a/example/vertex_basics.cpp +++ b/example/vertex_basics.cpp @@ -57,8 +57,8 @@ template < class Graph > struct print_edge { print_edge(Graph& g) : G(g) {} - typedef typename boost::graph_traits< Graph >::edge_descriptor Edge; - typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex; + using Edge = typename boost::graph_traits< Graph >::edge_descriptor; + using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor; void operator()(Edge e) const { auto id = get(vertex_index, G); @@ -76,7 +76,7 @@ template < class Graph > struct print_index { print_index(Graph& g) : G(g) {} - typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor; void operator()(Vertex c) const { typename boost::property_map< Graph, vertex_index_t >::type id @@ -89,7 +89,7 @@ template < class Graph > struct print_index template < class Graph > struct exercise_vertex { - typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex; + using Vertex = typename boost::graph_traits< Graph >::vertex_descriptor; exercise_vertex(Graph& _g) : g(_g) {} @@ -123,9 +123,9 @@ template < class Graph > struct exercise_vertex int main() { - typedef adjacency_list< vecS, vecS, bidirectionalS > MyGraphType; + using MyGraphType = adjacency_list< vecS, vecS, bidirectionalS >; - typedef pair< int, int > Pair; + using Pair = pair< int, int >; Pair edge_array[11] = { Pair(0, 1), Pair(0, 2), Pair(0, 3), Pair(0, 4), Pair(2, 0), Pair(3, 0), Pair(2, 4), Pair(3, 1), Pair(3, 4), Pair(4, 0), Pair(4, 1) }; diff --git a/example/vf2_sub_graph_iso_example.cpp b/example/vf2_sub_graph_iso_example.cpp index 613cb696..d18bb5a3 100644 --- a/example/vf2_sub_graph_iso_example.cpp +++ b/example/vf2_sub_graph_iso_example.cpp @@ -13,7 +13,7 @@ using namespace boost; int main() { - typedef adjacency_list< setS, vecS, bidirectionalS > graph_type; + using graph_type = adjacency_list< setS, vecS, bidirectionalS >; // Build graph1 int num_vertices1 = 8; diff --git a/example/vf2_sub_graph_iso_multi_example.cpp b/example/vf2_sub_graph_iso_multi_example.cpp index 235df83d..240f7abc 100644 --- a/example/vf2_sub_graph_iso_multi_example.cpp +++ b/example/vf2_sub_graph_iso_multi_example.cpp @@ -12,14 +12,13 @@ using namespace boost; int main() { - typedef property< edge_name_t, char > edge_property; - typedef property< vertex_name_t, char, property< vertex_index_t, int > > - vertex_property; + using edge_property = property< edge_name_t, char >; + using vertex_property + = property< vertex_name_t, char, property< vertex_index_t, int > >; // Using a vecS graphs => the index maps are implicit. - typedef adjacency_list< vecS, vecS, bidirectionalS, vertex_property, - edge_property > - graph_type; + using graph_type = adjacency_list< vecS, vecS, bidirectionalS, + vertex_property, edge_property >; // Build graph1 graph_type graph1; diff --git a/example/visitor.cpp b/example/visitor.cpp index 75b83e30..93012e3d 100644 --- a/example/visitor.cpp +++ b/example/visitor.cpp @@ -50,8 +50,8 @@ using namespace std; template < class Tag > struct edge_printer : public base_visitor< edge_printer< Tag > > { - typedef Tag event_filter; - edge_printer(std::string edge_t) : m_edge_type(edge_t) {} + using event_filter = Tag; + edge_printer(std::string edge_t) : m_edge_type(edge_t) { } template < class Edge, class Graph > void operator()(Edge e, Graph& G) { std::cout << m_edge_type << ": " << source(e, G) << " --> " @@ -69,13 +69,13 @@ int main(int, char*[]) using namespace boost; - typedef adjacency_list<> Graph; - typedef std::pair< int, int > E; + using Graph = adjacency_list<>; + using E = std::pair< int, int >; const auto edges = { E(0, 2), E(1, 1), E(1, 3), E(2, 1), E(2, 3), E(3, 1), E(3, 4), E(4, 0), E(4, 1) }; Graph G(std::begin(edges), std::end(edges), 5); - typedef boost::graph_traits< Graph >::vertices_size_type size_type; + using size_type = boost::graph_traits< Graph >::vertices_size_type; std::vector< size_type > d(num_vertices(G)); std::vector< size_type > f(num_vertices(G)); diff --git a/example/weighted_matching_example.cpp b/example/weighted_matching_example.cpp index 50fe5d50..b716e6ef 100644 --- a/example/weighted_matching_example.cpp +++ b/example/weighted_matching_example.cpp @@ -15,10 +15,10 @@ using namespace boost; -typedef property< edge_weight_t, float, property< edge_index_t, int > > - EdgeProperty; -typedef adjacency_list< vecS, vecS, undirectedS, no_property, EdgeProperty > - my_graph; +using EdgeProperty + = property< edge_weight_t, float, property< edge_index_t, int > >; +using my_graph + = adjacency_list< vecS, vecS, undirectedS, no_property, EdgeProperty >; int main(int argc, const char* argv[]) { diff --git a/example/write_graphviz.cpp b/example/write_graphviz.cpp index c033fcb9..dadf6b5d 100644 --- a/example/write_graphviz.cpp +++ b/example/write_graphviz.cpp @@ -37,7 +37,7 @@ const char* name[] = { "dax.h", "yow.h", "boz.h", "zow.h", "foo.cpp", "foo.o", int main(int, char*[]) { - typedef std::pair< int, int > Edge; + using Edge = std::pair< int, int >; Edge used_by[] = { Edge(dax_h, foo_cpp), Edge(dax_h, bar_cpp), Edge(dax_h, yow_h), Edge(yow_h, bar_cpp), Edge(yow_h, zag_cpp), Edge(boz_h, bar_cpp), Edge(boz_h, zig_cpp), Edge(boz_h, zag_cpp), @@ -52,10 +52,9 @@ int main(int, char*[]) using namespace boost; - typedef adjacency_list< vecS, vecS, directedS, + using Graph = adjacency_list< vecS, vecS, directedS, property< vertex_color_t, default_color_type >, - property< edge_weight_t, int > > - Graph; + property< edge_weight_t, int > >; Graph g(used_by, used_by + nedges, weights, N); write_graphviz(std::cout, g, make_label_writer(name));