mirror of
https://github.com/boostorg/graph.git
synced 2025-05-09 23:14:00 +00:00
Include examples in tests -
Fix C++17 build errors in examples. Disable some examples that use Unix-ism's from building on other platforms.
This commit is contained in:
parent
948eb2455a
commit
d51ba76e20
@ -3,6 +3,7 @@
|
||||
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import ../../config/checks/config : requires ;
|
||||
|
||||
exe accum-compile-times : accum-compile-times.cpp ;
|
||||
exe actor_clustering : actor_clustering.cpp ;
|
||||
@ -10,7 +11,7 @@ exe adjacency_list : adjacency_list.cpp ;
|
||||
exe adjacency_list_io : adjacency_list_io.cpp ;
|
||||
exe adjacency_matrix : adjacency_matrix.cpp ;
|
||||
exe adj_list_ra_edgelist : adj_list_ra_edgelist.cpp ;
|
||||
exe astar-cities : astar-cities.cpp ;
|
||||
exe astar-cities : astar-cities.cpp : [ requires unistd_h ] ;
|
||||
exe astar_maze : astar_maze.cpp ;
|
||||
exe bellman-example : bellman-example.cpp ;
|
||||
exe bellman-ford-internet : bellman-ford-internet.cpp ;
|
||||
@ -125,7 +126,7 @@ exe kruskal-example : kruskal-example.cpp ;
|
||||
# exe kruskal-telephone : kruskal-telephone.cpp ;
|
||||
exe kuratowski_subgraph : kuratowski_subgraph.cpp ;
|
||||
# exe labeled_graph : last-mod-time.cpp ;
|
||||
exe last-mod-time : last-mod-time.cpp ;
|
||||
exe last-mod-time : last-mod-time.cpp : [ requires unistd_h ] ;
|
||||
|
||||
# These need LEDA:
|
||||
# exe leda-concept-check : leda-concept-check.cpp ;
|
||||
|
@ -46,7 +46,9 @@ typedef boost::graph_traits<grid>::vertex_descriptor vertex_descriptor;
|
||||
typedef boost::graph_traits<grid>::vertices_size_type vertices_size_type;
|
||||
|
||||
// A hash function for vertices.
|
||||
struct vertex_hash:std::unary_function<vertex_descriptor, std::size_t> {
|
||||
struct vertex_hash{
|
||||
typedef vertex_descriptor argument_type;
|
||||
typedef std::size_t result_type;
|
||||
std::size_t operator()(vertex_descriptor const& u) const {
|
||||
std::size_t seed = 0;
|
||||
boost::hash_combine(seed, u[0]);
|
||||
|
@ -35,7 +35,11 @@ main()
|
||||
|
||||
for (int c = 0; c < w.size(); ++c)
|
||||
w[c] = c;
|
||||
#ifndef BOOST_NO_CXX98_RANDOM_SHUFFLE
|
||||
std::random_shuffle(w.begin(), w.end());
|
||||
#else
|
||||
std::shuffle(w.begin(), w.end(), gen);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < N; ++i)
|
||||
Q.push(i);
|
||||
|
@ -63,9 +63,11 @@ void merge_vertex
|
||||
|
||||
template <class StoredEdge>
|
||||
struct order_by_name
|
||||
: public std::binary_function<StoredEdge,StoredEdge,bool>
|
||||
{
|
||||
bool operator()(const StoredEdge& e1, const StoredEdge& e2) const {
|
||||
typedef StoredEdge first_argument_type;
|
||||
typedef StoredEdge second_argument_type;
|
||||
typedef bool result_type;
|
||||
bool operator()(const StoredEdge& e1, const StoredEdge& e2) const {
|
||||
// Using std::pair operator< as an easy way to get lexicographical
|
||||
// compare over tuples.
|
||||
return std::make_pair(e1.get_target(), boost::get(boost::edge_name, e1))
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <iostream>
|
||||
#include <stack>
|
||||
#include <queue>
|
||||
#include <ctime>
|
||||
#include <boost/operators.hpp>
|
||||
#include <boost/graph/breadth_first_search.hpp>
|
||||
#include <boost/graph/visitors.hpp>
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
|
@ -32,8 +32,10 @@
|
||||
|
||||
template <class StoredEdge>
|
||||
struct order_by_name
|
||||
: public std::binary_function<StoredEdge,StoredEdge,bool>
|
||||
{
|
||||
typedef StoredEdge first_argument_type;
|
||||
typedef StoredEdge second_argument_type;
|
||||
typedef bool result_type;
|
||||
bool operator()(const StoredEdge& e1, const StoredEdge& e2) const {
|
||||
// Order by target vertex, then by name.
|
||||
// std::pair's operator< does a nice job of implementing
|
||||
|
@ -164,3 +164,5 @@ if $(LEDA)
|
||||
compile leda_graph_cc.cpp :
|
||||
<include>$(leda-include) ;
|
||||
}
|
||||
|
||||
build-project ../example ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user