mirror of
https://github.com/boostorg/graph.git
synced 2026-01-19 04:12:11 +00:00
Compile the SGB examples. (#87)
Works fine with c++11, thanks! System: (K)Ubuntu 16.04 LTS Compiler: g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 Try to 'g++ -c' the four SGB examples girth.cpp, miles_span.cpp, roget_components.cpp, and topo-sort-with-sgb.cpp. (1) SGB 2002-01-30 changed the 'Associated Press scores' from 'ap0' and 'ap1' to 'ap'. This preprocessor macro (sic!) collides with numerous function parameters in 'named_function_params.hpp'. '#undef'ining the macro doesn't break the BGL examples. (2) girth.cpp fails because of a missing 'null_vertex()' function. (3) roget_components.cpp invokes 'strncmp()' from the C library. (4) topo-sort-with-sgb.cpp hickups because of a missing 'vertices()' function. Following roget_components.cpp and putting the collective SGB header up front fixes this.
This commit is contained in:
committed by
Noel Belcourt
parent
eda383e91d
commit
74115a2a1e
@@ -7,7 +7,8 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//=======================================================================
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <boost/graph/stanford_graph.hpp>
|
||||
#include <boost/graph/strong_components.hpp>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <boost/graph/topological_sort.hpp>
|
||||
#include <boost/graph/stanford_graph.hpp>
|
||||
#include <boost/graph/topological_sort.hpp>
|
||||
|
||||
int
|
||||
main()
|
||||
|
||||
@@ -46,6 +46,8 @@ extern "C" {
|
||||
#include <gb_books.h> /* graphs based on literature */
|
||||
#include <gb_econ.h> /* graphs based on economic data */
|
||||
#include <gb_games.h> /* graphs based on football scores */
|
||||
#undef ap /* avoid name clash with BGL parameter */
|
||||
// ap ==> Vertex::u.I
|
||||
#include <gb_gates.h> /* graphs based on logic circuits */
|
||||
#undef val /* avoid name clash with g++ headerfile stl_tempbuf.h */
|
||||
// val ==> Vertex::x.I
|
||||
@@ -92,6 +94,9 @@ namespace boost {
|
||||
typedef directed_tag directed_category;
|
||||
typedef sgb_traversal_tag traversal_category;
|
||||
typedef allow_parallel_edge_tag edge_parallel_category;
|
||||
/** Return a null descriptor */
|
||||
static vertex_descriptor null_vertex()
|
||||
{ return NULL; }
|
||||
};
|
||||
template <> struct graph_traits<sgb_const_graph_ptr> {
|
||||
typedef Vertex* vertex_descriptor;
|
||||
@@ -107,6 +112,9 @@ namespace boost {
|
||||
typedef directed_tag directed_category;
|
||||
typedef sgb_traversal_tag traversal_category;
|
||||
typedef allow_parallel_edge_tag edge_parallel_category;
|
||||
/** Return a null descriptor */
|
||||
static vertex_descriptor null_vertex()
|
||||
{ return NULL; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user